Fixes multiple issues with script creation