Fixing some scripting issues