Python 3 full compatibility

Some trivial fixes for Python 3 compatibility.

If you can also update PyPi with this it would be awesome :)