added python3 compatibility