Index: /trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- /trunk/ppImage/src/ppImageParseCamera.c	(revision 11100)
+++ /trunk/ppImage/src/ppImageParseCamera.c	(revision 11101)
@@ -18,5 +18,5 @@
 
     // determine filter from the concepts
-    char *filter = psMetadataLookupStr (&status, input->fpa->concepts, "FPA.FILTER");
+    char *filter = pmConceptsFilterIDfromConcept ("FPA.FILTER", input->fpa->concepts, config->camera);
 
 #if 0
@@ -87,37 +87,12 @@
 
     if (options->doFlat) {
-	// select FLAT.FILTERS from the recipe and test if the filter matches
-	// is the mdi saved with psList or string?
-	psMetadataItem *mdi = psMetadataLookup (recipe, "FLAT.FILTERS");
-	if (mdi == NULL) {
-	    // no valid filters for flat data for this camera
-	    options->doFlat = false;
-	    goto skip_flat;
-	}
-	// place entry on a list regardless of type
-	psList *filters = NULL;
-	if (mdi->type == PS_DATA_STRING) {
-	    filters = psListAlloc(NULL);
-	    psListAdd (filters, PS_LIST_HEAD, mdi);
-	} else {
-	    if (mdi->type != PS_DATA_METADATA_MULTI) psAbort ("ppImage", "invalid type for FLAT.FILTERS");
-	    filter = psMemIncrRefCounter(mdi->data.list);
-	}
-
-	// search through list to find the current filter
-	psListIterator *iter = psListIteratorAlloc (filters, PS_LIST_HEAD, FALSE);
-	options->doFlat = false;
-	for (int i = 0; !options->doFlat && (i < filters->n); i++) {
-	    psMetadataItem *item = psListGetAndIncrement (iter);
-	    char *validFilter = item->data.V;
-	    if (strcmp (validFilter, filter)) continue;
-	    options->doFlat = true;
-	}
-    }
-skip_flat:
-    if (options->doFlat) {
+	// if we fail to find the item in Args, we try again in Conf, then DetDB
+	// we need to handle the errors and catch serious errors, as opposed to
+	// data-not-found errors
 	bool status = false;
 	pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FLAT", "FLAT");
+	psErrorClear();
 	pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FLAT");
+	psErrorClear();
 	pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT);
 	if (!status) {
@@ -127,4 +102,7 @@
     }
 
+    // fringe frame are only applied for a subset of the filters.  
+    // if the filter is one of those identified by a FRINGE.FILTERS metadata entry
+    // in ppImage.config, apply the fringe frame
     if (options->doFringe) {
 	// select FRINGE.FILTERS from the recipe and test if the filter matches
@@ -143,5 +121,5 @@
 	} else {
 	    if (mdi->type != PS_DATA_METADATA_MULTI) psAbort ("ppImage", "invalid type for FRINGE.FILTERS");
-	    filter = psMemIncrRefCounter(mdi->data.list);
+	    filters = psMemIncrRefCounter(mdi->data.list);
 	}
 
