Fixed small bugs in python 3