modify to support python2.7