Index: /trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- /trunk/ppImage/src/ppImageParseCamera.c	(revision 11144)
+++ /trunk/ppImage/src/ppImageParseCamera.c	(revision 11145)
@@ -16,7 +16,4 @@
         return NULL;
     }
-
-    // determine filter from the concepts
-    char *filter = pmConceptsFilterIDfromConcept ("FPA.FILTER", input->fpa->concepts, config->camera);
 
 #if 0
@@ -87,61 +84,68 @@
 
     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) {
-	    psError (PS_ERR_IO, false, "can't find a flat image source");
-	    return NULL;
-	}
-    }
-
-    // fringe frame are only applied for a subset of the filters.  
+        // 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) {
+            psError (PS_ERR_IO, false, "can't find a flat image source");
+            return NULL;
+        }
+    }
+
+    // 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
-	// is the mdi saved with psList or string?
-	psMetadataItem *mdi = psMetadataLookup (recipe, "FRINGE.FILTERS");
-	if (mdi == NULL) {
-	    // no valid filters for fringe data for this camera
-	    options->doFringe = false;
-	    goto skip_fringe;
-	}
-	// 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 FRINGE.FILTERS");
-	    filters = psMemIncrRefCounter(mdi->data.list);
-	}
-
-	// search through list to find the current filter
-	psListIterator *iter = psListIteratorAlloc (filters, PS_LIST_HEAD, FALSE);
-	options->doFringe = false;
-	for (int i = 0; !options->doFringe && (i < filters->n); i++) {
-	    psMetadataItem *item = psListGetAndIncrement (iter);
-	    char *validFilter = item->data.V;
-	    if (strcmp (validFilter, filter)) continue;
-	    options->doFringe = true;
-	}
+        // determine filter from the concepts
+        const char *filter = psMetadataLookupStr(&status, input->fpa->concepts, "FPA.FILTER");
+        if (!status || !filter || strlen(filter) == 0) {
+            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FPA.FILTER.\n");
+            return NULL;
+        }
+
+        // select FRINGE.FILTERS from the recipe and test if the filter matches
+        // is the mdi saved with psList or string?
+        psMetadataItem *mdi = psMetadataLookup (recipe, "FRINGE.FILTERS");
+        if (mdi == NULL) {
+            // no valid filters for fringe data for this camera
+            options->doFringe = false;
+            goto skip_fringe;
+        }
+        // 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 FRINGE.FILTERS");
+            filters = psMemIncrRefCounter(mdi->data.list);
+        }
+
+        // search through list to find the current filter
+        psListIterator *iter = psListIteratorAlloc (filters, PS_LIST_HEAD, FALSE);
+        options->doFringe = false;
+        for (int i = 0; !options->doFringe && (i < filters->n); i++) {
+            psMetadataItem *item = psListGetAndIncrement (iter);
+            char *validFilter = item->data.V;
+            if (strcmp (validFilter, filter)) continue;
+            options->doFringe = true;
+        }
     }
 skip_fringe:
     if (options->doFringe) {
-	bool status = false;
-	pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FRINGE", "FRINGE");
-	pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FRINGE");
-	pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE);
-	if (!status) {
-	    psError (PS_ERR_IO, false, "can't find a fringe image source");
-	    return NULL;
-	}
+        bool status = false;
+        pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FRINGE", "FRINGE");
+        pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FRINGE");
+        pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE);
+        if (!status) {
+            psError (PS_ERR_IO, false, "can't find a fringe image source");
+            return NULL;
+        }
     }
 
