Python 3 unit test fixes