bug & style fixes based on pylint report
Merge pull request #5506 from hulu/pylint-fixes-2

bug & style fixes based on pylint report