IIRC triggers don't necessarily follow the top to bottom flow of the event sheet. There is a possibility that the trigger for the timer ending might happen before the every tick event, setting the variable to 0, and then back to one in the same tick.