fix variable scope bug when calling `willExitState`
Merge pull request #86 from 140am/master

`willExitState` fix