Pep8 and fix failed tests