Trying to figure out why the script is failing