Index: trunk/psModules/src/camera/pmFPAfile.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfile.c	(revision 7679)
+++ trunk/psModules/src/camera/pmFPAfile.c	(revision 7727)
@@ -248,15 +248,15 @@
 // given an already-opened fits file, write the components corresponding
 // to the specified view
-bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, psMetadata *format, int xBin, int yBin, const pmFPAview *view)
-{
+bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, int xBin, int yBin, const pmFPAview *view)
+{
+    bool status;
     PS_ASSERT_PTR_NON_NULL(out, false);
     PS_ASSERT_PTR_NON_NULL(in, false);
-    PS_ASSERT_PTR_NON_NULL(format, false);
     PS_ASSERT_PTR_NON_NULL(view, false);
 
     // pmFPAWrite takes care of all PHUs as needed
-    if (view->chip == -1) {
-        pmFPAAddSourceFromView (out, view, format);
-        return pmFPACopyStructure (out, in, xBin, yBin);
+    if ((view->chip == -1) || in->hdu) {
+        status = pmFPACopyStructure (out, in, xBin, yBin);
+        return status;
     }
     if (view->chip >= in->chips->n) {
@@ -267,9 +267,7 @@
     pmChip *outChip = out->chips->data[view->chip];
 
-    if (view->cell == -1) {
-        pmFPAAddSourceFromView (out, view, format);
-        // XXX this is a hack: can i defer this to ppImageRebinChip?
-        // bool status = pmChipCopyStructure (outChip, inChip, xBin, yBin);
-        return true;
+    if ((view->cell == -1) || inChip->hdu) {
+        status = pmChipCopyStructure (outChip, inChip, xBin, yBin);
+        return status;
     }
     if (view->cell >= inChip->cells->n) {
@@ -281,11 +279,9 @@
     pmCell *outCell = outChip->cells->data[view->cell];
 
-    if (view->readout == -1) {
-        pmFPAAddSourceFromView (out, view, format);
-        return pmCellCopyStructure (outCell, inCell, xBin, yBin);
+    if ((view->readout == -1) || inCell->hdu) {
+        status = pmCellCopyStructure (outCell, inCell, xBin, yBin);
+        return status;
     }
     psError(PS_ERR_UNKNOWN, true, "Returning false");
     return false;
-
-    // XXX add readout / segment equivalents
-}
+}
