Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 28514)
+++ trunk/magic/remove/src/streaksremove.c	(revision 29806)
@@ -921,8 +921,9 @@
     }
 
-    // Extension with PSF fits, should be "something.psf"
+    // Extension with PSF fits, should be "CLASS_ID.psf"
+    // This assumes that the sources extension comes first
     {
         if (!psFitsMoveExtNum(in->fits, 1, true)) {
-            psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name);
+            psErrorStackPrint(stderr, "failed to move to extension 1 in from %s", in->resolved_name);
             streaksExit("", PS_EXIT_DATA_ERROR);
         }
@@ -999,5 +1000,33 @@
     }
 
-    // XXX Will need to update to handle extension with extended sources, etc.
+    // Copy any other extensions in the file (deteff for example) to the output
+    // XXX: This assumes that all we have is binary tables.
+    for (int i = 2; i< in->nHDU; i++) {
+        if (!psFitsMoveExtNum(in->fits, 1, true)) {
+            psErrorStackPrint(stderr, "failed to move to extension number %d in %s", i, in->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
+        psMetadata *header = psFitsReadHeader(NULL, in->fits);
+        if (!header) {
+            psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
+        psString extname = psMetadataLookupStr(NULL, header, "EXTNAME");
+        if (!extname) {
+            psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
+
+        psArray *inTable = psFitsReadTable(in->fits);
+        if (!inTable) {
+            psErrorStackPrint(stderr, "failed to read table in %s", in->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
+        if (! psFitsWriteTable(out->fits, header, inTable, extname)) {
+            psErrorStackPrint(stderr, "failed to write table to %s", out->resolved_name);
+            streaksExit("", PS_EXIT_DATA_ERROR);
+        }
+    }
+
 
     if (!psFitsClose(out->fits)) {
