Some fixes in the script