Fix various pyflakes detected errors