removed another memory leak in the StateMachine