Fix broken tests to support Python 3.