Fix tests and make pep8 happy