Index: trunk/ippTools/src/addtool.c
===================================================================
--- trunk/ippTools/src/addtool.c	(revision 33779)
+++ trunk/ippTools/src/addtool.c	(revision 33989)
@@ -292,5 +292,5 @@
       // }
     if (strcmp(stage,"staticsky") == 0) {
-      psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
+      psStringAppend(&query, " GROUP BY sky_id, stack_id");  //some reason it needs this
       }
 
@@ -525,7 +525,9 @@
 	psS64 stage_id =0; 
 	bool status = false;
-	psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+	//psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+	psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id");
+
 	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
+	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id");
 	  return false;
 	}
@@ -540,9 +542,9 @@
 
         // queue the exp
-	for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
-        if (!pxaddQueueByCamID(config,
+      	//for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
+	  if (!pxaddQueueByCamID(config,
 			       stage,
-                               stage_id,
-			       filter_id,
+			       stage_id,
+			       stack_id,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -555,7 +557,7 @@
                                minidvodb_group,
                                minidvodb_name
-        )) {
+				 )) {
             if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error sfg");
+	      psError(PS_ERR_UNKNOWN, false, "database error sfg");
             }
             psError(PS_ERR_UNKNOWN, false,
@@ -564,6 +566,6 @@
             psFree(output);
             return false;
-        }
-	}
+	  }
+	  //}
         psFree(row);
     }
