Index: trunk/psModules/src/concepts/pmConceptsWrite.c
===================================================================
--- trunk/psModules/src/concepts/pmConceptsWrite.c	(revision 10487)
+++ trunk/psModules/src/concepts/pmConceptsWrite.c	(revision 10967)
@@ -119,5 +119,11 @@
         if (spec->format) {
             formatted = spec->format(concept, cameraFormat, fpa, chip, cell);
+        } else if (strcmp(concept->name, spec->blank->name) != 0) {
+            // Adjust so that the name is correct
+            formatted = psMetadataItemCopy(concept);
+            psFree(formatted->name);
+            formatted->name = psStringCopy(spec->blank->name);
         } else {
+            // Can get away with merely incrementing the reference counter
             formatted = psMemIncrRefCounter((const psPtr)concept);
         }
@@ -294,5 +300,5 @@
     PS_ASSERT_PTR_NON_NULL(concepts, false);
 
-    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
+    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
     if (!hdu) {
         return false;
@@ -316,22 +322,28 @@
                 // It's a menu --- need to look up the .DEPEND
                 psString dependName = NULL; // The concept name with ".DEPEND" on the end
-                psStringAppend(&dependName, ".DEPEND");
+                psStringAppend(&dependName, "%s.DEPEND", defaultItem->name);
                 psString dependKey = psMetadataLookupStr(&mdok, defaults, dependName); // The keyword
-                psFree(dependName);
                 if (!mdok || !dependKey || strlen(dependKey) == 0) {
                     psLogMsg(__func__, PS_LOG_WARN, "Can't find %s in the DEFAULTS for %s --- ignored.\n",
                              dependName, name);
+                    psFree(dependName);
                     continue;
                 }
-                psString dependValue = psMetadataLookupStr(&mdok, concepts, dependName); // The value
-                if (!mdok || !dependKey || strlen(dependKey) == 0) {
+                psString dependValue = psMetadataLookupStr(&mdok, concepts, dependKey); // The value
+                if (!mdok || !dependValue || strlen(dependValue) == 0) {
                     psLogMsg(__func__, PS_LOG_WARN, "Concept %s specified by %s isn't of type STR -- "
-                             "ignored.\n", name, dependName);
+                             "ignored.\n", dependKey, dependName);
+                    psFree(dependName);
                     continue;
                 }
-                conceptItem = psMetadataLookup(defaultItem->data.V, dependValue);
+                psFree(dependName);
+                // Get the actual item of interest, and correct the name to match the concept name
+                defaultItem = psMetadataItemCopy(psMetadataLookup(defaultItem->data.md, dependValue));
+                psFree(defaultItem->name);
+                defaultItem->name = psStringCopy(name);
             } else {
-                conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
-            }
+                psMemIncrRefCounter(defaultItem);
+            }
+            conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
             psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, fpa, chip, cell);
             if (!formatted) {
@@ -342,4 +354,5 @@
                          "format, but the values don't match.\n", name);
             }
+            psFree(defaultItem);
             psFree(formatted);
         }
@@ -356,5 +369,5 @@
     PS_ASSERT_PTR_NON_NULL(concepts, false);
 
-    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
+    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
     if (!hdu) {
         return false;
@@ -408,5 +421,5 @@
     #else
 
-    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
+    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
     if (!hdu) {
         return false;
