fixed bug related to script-inserted scripts