set of code fixes for python 3