bug & style fixes based on pylint report