fix errors in scripting engine