Index: branches/bills_081204/ippTools/src/magictool.c
===================================================================
--- branches/bills_081204/ippTools/src/magictool.c	(revision 20954)
+++ branches/bills_081204/ippTools/src/magictool.c	(revision 20964)
@@ -160,4 +160,11 @@
             }
         }
+        // now add the user specified qualifiers
+        if (psListLength(where->list)) {
+            psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+            psStringAppend(&queryWhere, " %s %s", queryWhere == NULL ? "WHERE" : "AND", whereClause);
+            psFree(whereClause);
+        }
+        psFree(where);
         if (!queryWhere) {
             psStringAppend(&queryWhere, " ");
@@ -207,5 +214,5 @@
         psMetadata *row = output->data[i]; // Row of interest
         psS64 exp_id = psMetadataLookupS64(NULL, row, "exp_id"); // Exposure identifier
-        psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id"); // Exposure identifier
+        psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id"); // difference identifier
 
         // create a new magicRun for this group
