Make Python3 compatible

Thanks for the great project! Just a few small changes to make the code python 3 compatible.