fix most issues reported by pyflakes