Fixed the generation of 'ToInternal' to check for null only fields of a ref type