fixed a devious bug related to function scope
Merge pull request #12 from jenius/master

Fix for a bug I introduced... sorry!