Index: trunk/magic/remove/src/streaksreplace.c
===================================================================
--- trunk/magic/remove/src/streaksreplace.c	(revision 30315)
+++ trunk/magic/remove/src/streaksreplace.c	(revision 30527)
@@ -75,5 +75,5 @@
                 if (sfiles->inWeight) {
                     double recWeightValue = psImageGet(sfiles->recWeight->image, x, y);
-                    if (recWeightValue != NAN) {
+                    if (!isnan(recWeightValue)) {
                         psImageSet(sfiles->inWeight->image, x, y, recWeightValue);
                     }
@@ -86,4 +86,8 @@
 
     } while (streakFilesNextExtension(sfiles));
+
+    // check the weight and mask files for extra extensions that might be in files
+    // (covariance matrix for example)
+    copyExtraExtensions(sfiles);
 
     // close all files
@@ -235,5 +239,5 @@
             usage();
         }
-        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.MASK", 0,
+        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "RECOVERY.MASK", 0,
                 "name of input mask image", argv[argnum]);
         psArgumentRemove(argnum, &argc, argv);
@@ -251,5 +255,5 @@
             usage();
         }
-        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.WEIGHT", 0,
+        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "RECOVERY.WEIGHT", 0,
                 "name of input weight image", argv[argnum]);
         psArgumentRemove(argnum, &argc, argv);
@@ -321,5 +325,4 @@
         addDestreakKeyword(sf->outMask->header, false);
 
-        // XXX: TODO
         setupImageRefs(sf->outMask, NULL, sf->inMask, sf->extnum, false);
 
@@ -333,5 +336,5 @@
         sf->outWeight->header = (psMetadata*) psMemIncrRefCounter(sf->inWeight->header);
         addDestreakKeyword(sf->outWeight->header, false);
-        setupImageRefs(sf->outMask, NULL, sf->inMask, sf->extnum, false);
+        setupImageRefs(sf->outWeight, NULL, sf->inWeight, sf->extnum, false);
 
         copyFitsOptions(sf->outWeight, NULL, sf->inWeight, sf->tiles);
