Found and fixed another error that stops the script abruptly