Fixed errors found when run through pyflakes