Python 3 support

This PR removes a couple of errors with Python 3.