Fixed bug in StateMachine class template.