Bugfix: replaced calls to enter_editmode() and exit_editmode(), which would cause segfaults on scripts run in background mode (discovered by NichG).
Bugfix: replaced calls to enter_editmode() and exit_editmode(), which would cause segfaults on scripts run in background mode (discovered by NichG).