Fix remaining py3k syntax errors
Merge pull request #1180 from alex/py3-syntax

Fix remaining py3k syntax errors