Index: trunk/ppSim/src/ppSimSequenceBias.c
===================================================================
--- trunk/ppSim/src/ppSimSequenceBias.c	(revision 19315)
+++ trunk/ppSim/src/ppSimSequenceBias.c	(revision 27967)
@@ -1,5 +1,5 @@
 # include "ppSimSequence.h"
 
-bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
+bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand, psArray *files) {
 
     bool status, setLevel, setRange;
@@ -14,5 +14,5 @@
     int nImage = 0;
     for (int i = 0; i < nImages; i++) {
-	    
+	        
 	// define the output filename
 	psString filename = NULL;
@@ -30,19 +30,23 @@
 	if (setLevel) psStringAppend (&command, " -biaslevel %f", level);
 	if (setRange) psStringAppend (&command, " -biasrange %f", range);
-      
+          
 	psStringAppend (&command, " %s", filename);
 
 	fprintf (simfile, "%s\n", command);
 	psFree (command);
-			    
+			        
 	// define the inject command
 	// path should be dirname/filename
-	command = psStringCopy (injectCommand);
-	psStringAppend (&command, " %s*.fits",    filename);
-	fprintf (inject, "%s\n", command);
-	psFree (command);
+	
+	// we use the filename above (really the file root) to construct the filenames
+	for (int i = 0; i < files->n; i++) {
+	    command = psStringCopy (injectCommand);
+            psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
+            fprintf (inject, "%s\n", command);
+	    psFree (command);
+	}
+
 	psFree (filename);
-
-	nImage ++;
+        nImage ++;
     }
     return true;
