pep8 and other minor fixes