made it work with python2