Last of the porting to python 3 fixes