Fixes to tests and flake8 issues.