Index: trunk/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- trunk/psModules/src/detrend/pmDetrendDB.c	(revision 11508)
+++ trunk/psModules/src/detrend/pmDetrendDB.c	(revision 11876)
@@ -24,4 +24,7 @@
 
     psFree (options->camera);
+    psFree (options->filter);
+    psFree (options->dettype);
+    psFree (options->version);
 
     return;
@@ -41,7 +44,16 @@
 
     // these other options depend on the type of detrend data
-    options->filter = NULL;  //
-    options->exptime = -1.0; // the undefined value (safe since exptime >= 0)
-    options->airmass = -1.0; // the undefined value (safe since airmass >= 1)
+    options->filter   = NULL;
+    options->version  = NULL;
+    options->dettype  = NULL;
+    options->exptime  = 0.0; 
+    options->airmass  = 0.0; 
+    options->dettemp  = 0.0; 
+    options->twilight = 0.0; 
+
+    options->exptimeSet  = false; // not selected
+    options->airmassSet  = false; // not selected
+    options->dettempSet  = false; // not selected
+    options->twilightSet = false; // not selected
 
     return options;
@@ -105,5 +117,11 @@
     psString line = NULL;
     char *time = psTimeToISO (&options->time);
-    char *type = pmDetrendTypeToString (options->type);
+
+    char *type = NULL;
+    if (options->dettype) {
+	type = psMemIncrRefCounter (options->dettype);
+    } else {
+	type = pmDetrendTypeToString (options->type);
+    }
     unsigned int nFail;
 
@@ -114,9 +132,18 @@
         psStringAppend(&line, " -filter %s", options->filter);
     }
-    if (options->exptime > -1.0) {
+    if (options->version) {
+        psStringAppend(&line, " -version %s", options->version);
+    }
+    if (options->exptimeSet) {
         psStringAppend(&line, " -exp_time %f", options->exptime);
     }
-    if (options->airmass > -1.0) {
+    if (options->airmassSet) {
         psStringAppend(&line, " -airmass %f", options->airmass);
+    }
+    if (options->dettempSet) {
+        psStringAppend(&line, " -airmass %f", options->dettemp);
+    }
+    if (options->twilightSet) {
+        psStringAppend(&line, " -airmass %f", options->twilight);
     }
 
