Fixes to script