Add a check to avoid crash when there is no custom_fields