diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index b434e9177f4a825510401b4cfaf497a5dde9cc19..1a7daf14e73313e8ce217217960168e880e21bb7 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -694,15 +694,15 @@ void GModel::scaleMesh(double factor)
     }
 }
 
-std::set<int> &GModel::recomputeMeshPartitions()
+void GModel::recomputeMeshPartitions()
 {
+  meshPartitions.clear();
   for(eiter it = firstEdge(); it != lastEdge(); ++it)
     (*it)->recomputeMeshPartitions();
   for(fiter it = firstFace(); it != lastFace(); ++it)
     (*it)->recomputeMeshPartitions();
   for(riter it = firstRegion(); it != lastRegion(); ++it)
     (*it)->recomputeMeshPartitions();
-  return meshPartitions;
 }
 
 void GModel::deleteMeshPartitions()
diff --git a/Geo/GModel.h b/Geo/GModel.h
index 0b324c94113a12b6baae5dbdc87f19fa3527370f..6a20badac8bbfc26e635ad665863872d3eae5935 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -221,10 +221,7 @@ class GModel
 
   // The list of partitions
   std::set<int> &getMeshPartitions() { return meshPartitions; }
-  std::set<int> &recomputeMeshPartitions();
-
-  // Number of partitions
-  int getNumMeshPartitions() const { return meshPartitions.size(); }
+  void recomputeMeshPartitions();
 
   // Deletes all the partitions
   void deleteMeshPartitions();
diff --git a/Geo/GModelIO_CGNS.cpp b/Geo/GModelIO_CGNS.cpp
index 3c04d71dcf19e78f69b918896c95aba7fb33b862..8903a9686258d317e53ba56e5612eb8f2d116b46 100644
--- a/Geo/GModelIO_CGNS.cpp
+++ b/Geo/GModelIO_CGNS.cpp
@@ -610,7 +610,7 @@ int write_CGNS_zones(GModel &model, const int zoneDefinition,
 
 //--Shared data
 
-  const int numPartitions = model.getNumMeshPartitions();
+  const int numPartitions = model.getMeshPartitions().size();
   int threadsWorking = omp_get_num_threads();
                                         // Semaphore for working threads
   omp_lock_t threadWLock;