Fixed some flake8 warnings and errors.