fixed python 3 bugs