Some fixes for python3 compatibility.

Signed-off-by: David Hoffmann <david@hoffmann-projects.de>