Fix unit tests and pep8.