Merge pull request #276 from jeblair/master

Fix "global name 'i' is not defined" exception caused by typo.