Fix flake8 and restore loader tests.
More python3 fixes.