corrected wrong state transition in FSM