Fix flakes8 errors

Fix some flake8 errors on core