fix tests and pep8