Fix a few variables leaking in the global state.
Merge pull request #2 from mlavin/patch-1

Fix a few variables leaking in the global state