state machine fix