More fixes to the script