Fix StateMachine