Fixed crash that was caused when generating the primary data for referenced fields.