Fixed problem where mouse was hidden twice if state transition happened twice.