Fix export of user defined type as object. Thanks to Shanshan Wang for the report.