state machine update