flake8 and test fixes