modify to python2.7, fix emptyline bug