updates for python3 compatibility (still works with python2)

so, here's another try. ;-)