Fixes for Python 3