Fix errors in python 3