Fixed errors for python 3.