Fixed state machine consistency.

Fixed state machine consistency upon update coming from the game.
Introduced explicit invariant for checking this.