Fix import problems discovered by flake8