Fix crash in python 3.