upgrade state machine