Make compatible with python2

I don't have python3 on my machine, and just needed those few changes to make it work under python2, thought you might be interested.