fix mistakes in new state machine