Fixed a bug in the script from last commit