More changes to make it compatible with python3