Fix some errors detected with pyflakes