fix "state machine"