Fix issues reported by pyflakes

Unused imports and variables.