added python2 compatibility