Improper error handling / bad function logic.
The script is just a quick edit of some old old steem era script I made back when I wasn't quite as advanced coding wise as I am now. I'll update the code here later tonight to try and implement a fix for the issue.