fix pyflakes errors and warnings.