Some fixes for python3 compatability

Nothing here breaks compatibility with python2, but it would be nice if this package also worked with python3.