Attempt to fix problems with ScriptEngine crashing.