fixing some bugs in script and CSPreemptor