fix bunch of python 3 errors