Fix variable scope
Merge pull request #23 from richbarton/master

Fix variable scope