Fixes for python 3

This fixes some issues in Python 3