update state machine