fix some pyflake and pep8 warnings