code compiles but FSM doesn't work