Fix some pyflakes-undefined-name warnings
Merge pull request #201 from mitya57/pyflakes-fixes

Fix some pyflakes-undefined-name warnings