Many bug fixes. Thanks, pyflakes.
Pep8