Fixed flake8 errors.

Fixed the few warnings and erros given by flake8.

Thanks :)