Index: ../trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 13500)
+++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 13501)
@@ -211,6 +211,7 @@
 
 	int         numberofvertices;
 	int         dummy;
+	char*       driver=NULL;
 
 
 	/*Initialize array detecting whether data[i] is an independent AD mode variable: */
@@ -224,10 +225,36 @@
 		
 		#ifdef _HAVE_ADOLC_
 
-		/*Start the trace: */
-		trace_on(1);
-
-		/*build dataset made of independent objects: */
+		/*Start the trace:  {{{
+		 * to do so, figure out what kind of driver we are running. Then, according to ADOLC documentation, 
+		 * we'll need to activate keep. 
+		 *
+		 * From ADOLC userdoc: 
+		 * The optional integer argument keep of trace on determines whether the numerical values of all active variables are 
+		 * recorded in a buffered temporary array or file called the taylor stack. This option takes effect if keep = 1 and 
+		 * prepares the scene for an immediately following gradient evaluation by a call to a routine implementing the reverse 
+		 * mode as described in the Section 4 and Section 5. 
+		 *
+		 */
+		this->FetchData(&driver,AutodiffDriverEnum);
+		if (strlen(driver)<=3){
+			/*there is no "_reverse" string within the driver string: */
+			if(VerboseAutodiff())_pprintLine_("   trace activated with keep off");
+			trace_on(1);
+		}
+		else{
+			if (strcmp((const char*)(driver+3),"_reverse")==0){
+				if(VerboseAutodiff())_pprintLine_("   trace activated with keep on");
+				trace_on(1,1);
+			}
+			else{
+				if(VerboseAutodiff())_pprintLine_("   trace activated with keep off");
+				trace_on(1);
+			}
+		}
+		xDelete<char>(driver);
+		/*}}}*/
+		/*build dataset made of independent objects: {{{*/
 		this->independent_objects=new DataSet();
 		this->FetchData(&num_independent_objects,AutodiffNumIndependentObjectsEnum);
 		if(num_independent_objects){
@@ -249,7 +276,8 @@
 			}
 			xDelete<int>(names);
 			xDelete<int>(types);
-		}
+		} /*}}}*/
+
 		#else
 		/*if we asked for AD computations, we have a problem!: */
 		_error_("Cannot carry out AD mode computations without support of ADOLC compiled in!");
