I'm very sorry you found a bug.
I know what the problem should be from the information you provided, but going through the code and playtesting it this morning have failed to replicate it or find any problems in the script.
At my first attempt at a solution, I've rebuilt the game and re-uploaded it. Please can you download it again and see if you still get the error?
(It may be required that you play from the beginning, if the game is having trouble finding a variable I have defined, so apologies for that.)
If you do still get the error, please can you email me at email@example.com so I can send you a copy of the game with all the developer options turned back on and we can gather more information to fix the issue.