Index: trunk/psModules/src/objects/pmSourceIO.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO.c	(revision 15157)
+++ trunk/psModules/src/objects/pmSourceIO.c	(revision 15213)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-02 01:10:48 $
+ *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-04 04:23:32 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -352,4 +352,6 @@
                 }
 
+                pmConfigConformHeader(hdu->header, file->format);
+
                 psFitsWriteBlank (file->fits, hdu->header, headname);
                 psTrace ("pmFPAfile", 5, "wrote ext head %s (type: %d)\n", file->filename, file->type);
@@ -439,70 +441,68 @@
     if (phu) {
         psMetadataCopy (outhead, phu->header);
-    } else {
-        pmConfigConformHeader (outhead, file->format);
-
-        // We need to get some FPA-level concepts in there
-        // This is a hack, not very pretty.  But then, so is writing the FPA in this manner without
-        // using the pmFPAMosaic functions....
-
-        psMetadata *headers = psMetadataLookupMetadata(NULL, file->fpa->camera,
-                                                       BLANK_HEADERS); // Header names
-        if (!headers) {
+    }
+
+    pmConfigConformHeader (outhead, file->format);
+
+    // We need to get some FPA-level concepts in there
+    // This is a hack, not very pretty.  But then, so is writing the FPA in this manner without
+    // using the pmFPAMosaic functions....
+
+    psMetadata *headers = psMetadataLookupMetadata(NULL, file->fpa->camera, BLANK_HEADERS); // Header names
+    if (!headers) {
+        psError(PS_ERR_UNEXPECTED_NULL, false,
+                "Unable to find %s metadata within camera configuration", BLANK_HEADERS);
+        psFree(outhead);
+        return false;
+    }
+
+    {
+        const char *mjdName = psMetadataLookupStr(NULL, headers, "FPA.TIME"); // Header name
+        if (!mjdName || strlen(mjdName) == 0) {
             psError(PS_ERR_UNEXPECTED_NULL, false,
-                    "Unable to find %s metadata within camera configuration", BLANK_HEADERS);
+                    "Unable to find FPA.TIME in %s within camera configuration.", BLANK_HEADERS);
             psFree(outhead);
             return false;
         }
-
-        {
-            const char *mjdName = psMetadataLookupStr(NULL, headers, "FPA.TIME"); // Header name
-            if (!mjdName || strlen(mjdName) == 0) {
-                psError(PS_ERR_UNEXPECTED_NULL, false,
-                        "Unable to find FPA.TIME in %s within camera configuration.", BLANK_HEADERS);
-                psFree(outhead);
-                return false;
-            }
-            psTime *time = psMetadataLookupTime(NULL, file->fpa->concepts,
-                                                "FPA.TIME"); // Time of observation
-            double mjd = psTimeToMJD(time); // The MJD of observation
-            psMetadataAddF64(outhead, PS_LIST_TAIL, mjdName, PS_META_REPLACE,
-                             "Time of observation", mjd);
-        }
-
-        {
-            const char *expName = psMetadataLookupStr(NULL, headers, "FPA.EXPOSURE"); // Header name
-            if (!expName || strlen(expName) == 0) {
-                psError(PS_ERR_UNEXPECTED_NULL, false,
-                        "Unable to find FPA.EXPOSURE in %s within camera configuration.",
-                        BLANK_HEADERS);
-                psFree(outhead);
-                return false;
-            }
-            float exptime = psMetadataLookupF32(NULL, file->fpa->concepts,
-                                                "FPA.EXPOSURE"); // Exposure time
-            psMetadataAddF32(outhead, PS_LIST_TAIL, expName, PS_META_REPLACE,
-                             "Exposure time (sec)", exptime);
-        }
-
-        {
-            const char *amName = psMetadataLookupStr(NULL, headers, "FPA.AIRMASS"); // Header name
-            if (!amName || strlen(amName) == 0) {
-                psError(PS_ERR_UNEXPECTED_NULL, false,
-                        "Unable to find FPA.AIRMASS in %s within camera configuration.",
-                        BLANK_HEADERS);
-                psFree(outhead);
-                return false;
-            }
-            float airmass = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.AIRMASS"); // Airmass
-            psMetadataAddF32(outhead, PS_LIST_TAIL, amName, PS_META_REPLACE,
-                             "Observation airmass", airmass);
-        }
-
-        psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information
-        const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME");
-        if (fpaNameHdr && strlen(fpaNameHdr) > 0) {
-            const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME");
-            psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);
-        }
+        psTime *time = psMetadataLookupTime(NULL, file->fpa->concepts, "FPA.TIME"); // Time of observation
+        double mjd = psTimeToMJD(time); // The MJD of observation
+        psMetadataAddF64(outhead, PS_LIST_TAIL, mjdName, PS_META_REPLACE,
+                         "Time of observation", mjd);
+    }
+
+    {
+        const char *expName = psMetadataLookupStr(NULL, headers, "FPA.EXPOSURE"); // Header name
+        if (!expName || strlen(expName) == 0) {
+            psError(PS_ERR_UNEXPECTED_NULL, false,
+                    "Unable to find FPA.EXPOSURE in %s within camera configuration.",
+                    BLANK_HEADERS);
+            psFree(outhead);
+            return false;
+        }
+        float exptime = psMetadataLookupF32(NULL, file->fpa->concepts,
+                                            "FPA.EXPOSURE"); // Exposure time
+        psMetadataAddF32(outhead, PS_LIST_TAIL, expName, PS_META_REPLACE,
+                         "Exposure time (sec)", exptime);
+    }
+
+    {
+        const char *amName = psMetadataLookupStr(NULL, headers, "FPA.AIRMASS"); // Header name
+        if (!amName || strlen(amName) == 0) {
+            psError(PS_ERR_UNEXPECTED_NULL, false,
+                    "Unable to find FPA.AIRMASS in %s within camera configuration.",
+                    BLANK_HEADERS);
+            psFree(outhead);
+            return false;
+        }
+        float airmass = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.AIRMASS"); // Airmass
+        psMetadataAddF32(outhead, PS_LIST_TAIL, amName, PS_META_REPLACE,
+                         "Observation airmass", airmass);
+    }
+
+    psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information
+    const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.NAME");
+    if (fpaNameHdr && strlen(fpaNameHdr) > 0) {
+        const char *fpaName = psMetadataLookupStr(NULL, file->fpa->concepts, "FPA.NAME");
+        psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA name", fpaName);
     }
 
