pep8 compatiblity issue and some minor issues fixed