Fixes for Python 3 with 2to3