U3 fixes for Python 3

Please note that these are untested.