Minor fixes for Python 3 support