bugfixes in script system