Index: /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp
===================================================================
--- /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 3959)
+++ /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 3960)
@@ -11,4 +11,5 @@
 
 	/*input datasets: */
+	bool flag_ys0;
 	Vec uf=NULL;
 	Mat Gmn=NULL;
@@ -23,5 +24,8 @@
 
 	/*checks on arguments on the matlab side: */
-	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&MergesolutionfromftogUsage);
+	if((nlhs!=NLHS) || (nrhs!=4 && nrhs!=5)){
+		MergesolutionfromftogUsage();
+		ISSMERROR(" usage. See above");
+	}
 
 	/*Input datasets: */
@@ -32,5 +36,11 @@
 
 	/*!Reduce vector: */
-	Mergesolutionfromftogx(&ug, uf,Gmn,ys,nodesets);
+	if (nrhs==4){
+		Mergesolutionfromftogx(&ug, uf,Gmn,ys,nodesets);
+	}
+	else{
+		FetchData(&flag_ys0,YSFLAG);
+		Mergesolutionfromftogx(&ug, uf,Gmn,ys,nodesets,flag_ys0);
+	}
 
 	/*write output datasets: */
Index: /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h
===================================================================
--- /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h	(revision 3959)
+++ /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h	(revision 3960)
@@ -23,4 +23,5 @@
 #define YS (mxArray*)prhs[2]
 #define NODESETS (mxArray*)prhs[3]
+#define YSFLAG (mxArray*)prhs[4]
 
 /* serial output macros: */
@@ -31,5 +32,5 @@
 #define NLHS  1
 #undef NRHS
-#define NRHS  4
+#define NRHS  5
 
 #endif  /* _MERGESOLUTIONFROMFTOG_H */
Index: /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp
===================================================================
--- /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp	(revision 3959)
+++ /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp	(revision 3960)
@@ -11,4 +11,5 @@
 
 	/*input datasets: */
+	bool flag_ys0;
 	Vec pg=NULL;
 	Mat Gmn=NULL;
@@ -24,5 +25,8 @@
 
 	/*checks on arguments on the matlab side: */
-	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ReduceloadfromgtofUsage);
+	if((nlhs!=NLHS) || (nrhs!=5 && nrhs!=6)){
+		ReduceloadfromgtofUsage();
+		ISSMERROR(" usage. See above");
+	}
 
 	/*Input datasets: */
@@ -34,5 +38,12 @@
 
 	/*!Reduce load from g to f size: */
-	Reduceloadfromgtofx(&pf, pg, Gmn, Kfs, ys, nodesets);
+	if (nrhs==5){
+		Reduceloadfromgtofx(&pf, pg, Gmn, Kfs, ys, nodesets);
+	}
+	else{
+		FetchData(&flag_ys0,YSFLAG);
+		Reduceloadfromgtofx(&pf, pg, Gmn, Kfs, ys, nodesets,flag_ys0);
+	}
+
 
 	/*write output datasets: */
Index: /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.h
===================================================================
--- /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.h	(revision 3959)
+++ /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.h	(revision 3960)
@@ -24,4 +24,5 @@
 #define YS (mxArray*)prhs[3]
 #define NODESETS (mxArray*)prhs[4]
+#define YSFLAG (mxArray*)prhs[5]
 
 /* serial output macros: */
@@ -32,5 +33,5 @@
 #define NLHS  1
 #undef NRHS
-#define NRHS  5
+#define NRHS  6
 
 
Index: /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp
===================================================================
--- /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 3959)
+++ /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 3960)
@@ -16,5 +16,4 @@
 	/* output datasets: */
 	Vec ys=NULL;
-	Vec ys0=NULL;
 
 	/*Boot module: */
@@ -29,9 +28,8 @@
 
 	/*!Reduce vector: */
-	Reducevectorgtosx(&ys,&ys0, yg,nodesets);
+	Reducevectorgtosx(&ys,yg,nodesets);
 
 	/*write output datasets: */
 	WriteData(YS,ys);
-	WriteData(YS0,ys0);
 
 	/*Free ressources: */
@@ -39,5 +37,4 @@
 	VecFree(&yg);
 	VecFree(&ys);
-	VecFree(&ys0);
 
 	/*end module: */
@@ -48,5 +45,5 @@
 {
 	_printf_("\n");
-	_printf_("   usage: [ys,ys0] = %s(yg,nodesets);\n",__FUNCT__);
+	_printf_("   usage: ys = %s(yg,nodesets);\n",__FUNCT__);
 	_printf_("\n");
 }
Index: /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.h
===================================================================
--- /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.h	(revision 3959)
+++ /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.h	(revision 3960)
@@ -24,9 +24,8 @@
 /* serial output macros: */
 #define YS (mxArray**)&plhs[0]
-#define YS0 (mxArray**)&plhs[1]
 
 /* serial arg counts: */
 #undef NLHS
-#define NLHS  2
+#define NLHS  1
 #undef NRHS
 #define NRHS  2
