Python3 fixes.

Don't know if this is correct, its my first actual encounter with python3;-)