Fix py3

Fix a few small issues with Python 3.