diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 4ae9b44f4490a0e779048e395fd510701d5d3120..88dcc72821b31f254456513bc6f7500027f8a736 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -594,10 +594,14 @@ static void writeElementMSH(FILE *fp, GModel *model, T *ele, bool saveAll,
   if(saveAll)
     ele->writeMSH(fp, version, binary, ++num, elementary, 0,
                   parentNum, dom1Num, dom2Num, &ghosts);
-  else
-    for(unsigned int j = 0; j < physicals.size(); j++)
+  else{
+    if(parentNum) parentNum = parentNum - physicals.size() + 1;
+    for(unsigned int j = 0; j < physicals.size(); j++){
       ele->writeMSH(fp, version, binary, ++num, elementary, physicals[j],
                     parentNum, dom1Num, dom2Num, &ghosts);
+      if(parentNum) parentNum++;
+    }
+  }
 
   model->setMeshElementIndex(ele, num); // should really be a multimap...
 }