Index: /issm/trunk-jpl/src/c/classes/IssmComm.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IssmComm.cpp	(revision 14289)
+++ /issm/trunk-jpl/src/c/classes/IssmComm.cpp	(revision 14290)
@@ -13,18 +13,30 @@
 
 void IssmComm::SetComm(COMM incomm){ /*{{{*/
-	comm=incomm;
+
+	/*A comm is provided, we are running in parallel (this is not a module)*/
+	parallel = true;
+	comm     = incomm;
+
+}/*}}}*/
+void IssmComm::SetComm(void){ /*{{{*/
+
+	/*no comm provided, This is a matlab/python module*/
+	parallel = true;
+	comm     = incomm;
+
 }/*}}}*/
 COMM IssmComm::GetComm(){  /*{{{*/
+	if(!parallel) _error_("Cannot return comm in serial mode");
 	return comm;
 }/*}}}*/
 int IssmComm::GetRank(){  /*{{{*/
+
 	int my_rank = 0;
+	
+	/*for matlab and python modules*/
+	if(!parallel) return my_rank;
 
-	
 	#ifdef _HAVE_MPI_
 	MPI_Comm_rank(comm,&my_rank);
-	#else
-	/*for matlab and python modules, comm == -1*/
-	if((int)comm==-1) return my_rank;
 	#endif
 
@@ -36,4 +48,7 @@
 	int size = 1;
 
+	/*for matlab and python modules*/
+	if(!parallel) return size;
+
 	#ifdef _HAVE_MPI_
 	MPI_Comm_size(comm,&size);
Index: /issm/trunk-jpl/src/c/classes/IssmComm.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/IssmComm.h	(revision 14289)
+++ /issm/trunk-jpl/src/c/classes/IssmComm.h	(revision 14290)
@@ -21,10 +21,12 @@
 	private:
 		static COMM comm;
+		static bool parallel;
 
 	public:
 		static void SetComm(COMM incomm);
-		static COMM GetComm();
-		static int GetRank();
-		static int GetSize();
+		static void SetComm(void);
+		static COMM GetComm(void);
+		static int GetRank(void);
+		static int GetSize(void);
 };
 
