Fixed a bug that would be trigged by running the script as a git hook