Fixes for issue #45

Some minor fixes regarding Python 3 compatibility as well as a fix for imports that I took from the master branch.