state machine: fix runtime error