Fixed bugs on Python3.