Fixed an issue with custom types on Python 3.