pyflakes, pep8, and test fixes