some fixes to the script