Index: /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 13592)
+++ /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 13593)
@@ -14,5 +14,5 @@
 int pKrigingx(double** ppredictions,double **perror,double* obs_x, double* obs_y, double* obs_list, int obs_length,double* x_interp,double* y_interp,int n_interp,Options* options){
 
-	extern int num_procs;
+	int num_procs2;
 	int my_rank2;
 
@@ -30,4 +30,5 @@
 	/*Get my_rank2: */
 	my_rank2=IssmComm::GetRank();
+	num_procs2=IssmComm::GetSize();
 
 	/*Get some Options*/
@@ -58,5 +59,5 @@
 
 		/*partition loop across threads: */
-		for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
+		for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
 			_pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
@@ -76,5 +77,5 @@
 
 		/*partition loop across threads: */
-		for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
+		for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
 			_pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
@@ -93,5 +94,5 @@
 
 		/*partition loop across threads: */
-		for(int idx=my_rank2;idx<n_interp;idx+=num_procs){
+		for(int idx=my_rank2;idx<n_interp;idx+=num_procs2){
 			_pprintLine_("      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 13592)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp	(revision 13593)
@@ -23,5 +23,5 @@
 
 	int my_rank2;
-	extern int num_procs;
+	int num_procs2;
 	int    numberofelements;
 	int    numberofvertices;
@@ -49,4 +49,5 @@
 	/*Get my_rank2:*/
 	my_rank2=IssmComm::GetRank();
+	num_procs2=IssmComm::GetSize();
 
 	/*Fetch parameters: */
@@ -76,5 +77,5 @@
 	}
 
-	MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs);
+	MeshPartitionx(&epart, &npart,numberofelements,numberofvertices,elements, numberofelements2d,numberofvertices2d,elements2d,numlayers,elements_width, dim,num_procs2);
 
 	/*Free elements and elements2d: */
Index: /issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp	(revision 13592)
+++ /issm/trunk-jpl/src/c/solutions/DakotaSpawnCore.cpp	(revision 13593)
@@ -45,5 +45,4 @@
 	
 	int i;
-	extern int my_rank;
 	
 	char   **responses_descriptors     = NULL; //these are our!  there are only numresponsedescriptors of them, not d_numresponses!!!
@@ -104,5 +103,5 @@
 
 	int i;
-	extern int my_rank;
+	int my_rank2;
 
 	/*inputs and outputs: */
@@ -116,4 +115,6 @@
 	int   string_length;
 
+	/*recover my_rank2:*/
+	my_rank2=IssmComm::GetRank();
 
 	/*recover inputs from pointers: */
@@ -127,20 +128,20 @@
 	
 	/*variables:*/
-	if(my_rank!=0)variables=xNew<double>(numvariables);
+	if(my_rank2!=0)variables=xNew<double>(numvariables);
 	MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,IssmComm::GetComm()); 
 
 	/*variables_descriptors: */
-	if(my_rank!=0){
+	if(my_rank2!=0){
 		variables_descriptors=xNew<char*>(numvariables);
 	}
 	for(i=0;i<numvariables;i++){
-		if(my_rank==0){
+		if(my_rank2==0){
 			string=variables_descriptors[i];
 			string_length=(strlen(string)+1)*sizeof(char);
 		}
 		MPI_Bcast(&string_length,1,MPI_INT,0,IssmComm::GetComm()); 
-		if(my_rank!=0)string=xNew<char>(string_length);
+		if(my_rank2!=0)string=xNew<char>(string_length);
 		MPI_Bcast(string,string_length,MPI_CHAR,0,IssmComm::GetComm()); 
-		if(my_rank!=0)variables_descriptors[i]=string;
+		if(my_rank2!=0)variables_descriptors[i]=string;
 	}
 
@@ -159,5 +160,5 @@
 
 	int i;
-	extern int my_rank;
+	int my_rank2;
 	
 	double  *variables             = NULL;
@@ -171,7 +172,9 @@
 	responses_descriptors=*presponses_descriptors;
 
+	/*recover my_rank2:*/
+	my_rank2=IssmComm::GetRank();
 
 	/*Free variables and variables_descriptors only on cpu !=0*/
-	if(my_rank!=0){
+	if(my_rank2!=0){
 		xDelete<double>(variables);
 		for(i=0;i<numvariables;i++){
