Fixed a bug in cleanup code for AIStateMachine.
Merge pull request #948 from sgrenier/next

Fixed a bug in cleanup code for AIStateMachine.