fix a bunch of PEP8 & pyFlakes warnings

fix a bunch of PEP8 & pyFlakes warnings