Fix bug where events could get pushed in the middle of state transitions and not get detected