Index: trunk/psphot/src/psphotApResid.c
===================================================================
--- trunk/psphot/src/psphotApResid.c	(revision 8780)
+++ trunk/psphot/src/psphotApResid.c	(revision 8807)
@@ -124,8 +124,5 @@
 	    return false;
 	}
-    }
-
-    // constant and skybias only
-    if (!strcasecmp (ApTrendOption, "SKYBIAS")) {
+    } else if (!strcasecmp (ApTrendOption, "SKYBIAS")) { // constant and skybias only
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -145,7 +142,5 @@
 	    return false;
 	}
-    }
-
-    if (!strcasecmp (ApTrendOption, "SKYSAT")) {
+    } else if (!strcasecmp (ApTrendOption, "SKYSAT")) {
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -174,8 +169,5 @@
 	    return false;
 	}
-    }
-
-    // constant and linear X,Y only
-    if (!strcasecmp (ApTrendOption, "XY_LIN")) {
+    } else if (!strcasecmp (ApTrendOption, "XY_LIN")) {	// constant and linear X,Y only
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -195,8 +187,5 @@
 	    return false;
 	}
-    }
-
-    // constant and quadratic X,Y only
-    if (!strcasecmp (ApTrendOption, "XY_QUAD")) {
+    } else if (!strcasecmp (ApTrendOption, "XY_QUAD")) { // constant and quadratic X,Y only
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -216,8 +205,5 @@
 	    return false;
 	}
-    }
-
-     // constant and sky, linear X,Y only
-    if (!strcasecmp (ApTrendOption, "SKY_XY_LIN")) {
+    } else if (!strcasecmp (ApTrendOption, "SKY_XY_LIN")) { // constant and sky, linear X,Y only
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -237,8 +223,5 @@
 	    return false;
 	}
-    }
-
-     // constant and sky, linear X,Y only
-    if (!strcasecmp (ApTrendOption, "SKYSAT_XY_LIN")) {
+    } else if (!strcasecmp (ApTrendOption, "SKYSAT_XY_LIN")) { // constant and sky, linear X,Y only
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -267,7 +250,5 @@
 	    return false;
 	}
-    }
-
-    if (!strcasecmp (ApTrendOption, "ALL")) {
+    } else if (!strcasecmp (ApTrendOption, "ALL")) {
 	// first clip out objects which are too far from the median 
 	stats->clipIter = 2;
@@ -296,4 +277,7 @@
 	    return false;
 	}
+    } else {
+	psError(PSPHOT_ERR_PHOTOM, true, "Unknown APTREND value: %s", ApTrendOption);
+	return false;
     }
 
