more fixes to script