Fixed problems when creating scripts