fixed exceptions in the state machine example