diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index 0d1da05eb7c5f533ca05adecb9b50ba41e65a90c..10ee6c994ce27c1543d115061f8034ba874b398d 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -624,19 +624,20 @@ void MElement::writeMSH(FILE *fp, double version, bool binary, int num,
   int par = (parentNum) ? 1 : 0;
   int dom = (dom1Num) ? 2 : 0;
   bool poly = (type == MSH_POLYG_ || type == MSH_POLYH_ || type == MSH_POLYG_B);
-  bool polyb  = (type == MSH_LIN_B );
+  bool polyl  = (type == MSH_LIN_B || type == MSH_LIN_C);
 
   // if poly loop over children
-  if ( CTX::instance()->mesh.saveTri && poly){
+  if(CTX::instance()->mesh.saveTri && poly){
     for (int i = 0; i < getNumChildren() ; i++){
        MElement *t = getChild(i);
-       t->writeMSH(fp, version,binary,num,elementary,physical,0,0,0,ghosts);
+       t->writeMSH(fp, version, binary, num, elementary, physical, 0, 0, 0, ghosts);
     }
     return;
   }
-  else if (CTX::instance()->mesh.saveTri && polyb){
-    MLine *l = (MLine*)this;
-    l->writeMSH(fp, version,binary,num,elementary,physical, 0,0,0,ghosts);
+  else if(CTX::instance()->mesh.saveTri && polyl){
+    MLine *l = new MLine(getVertex(0), getVertex(1));
+    l->writeMSH(fp, version, binary, num, elementary, physical, 0, 0, 0, ghosts);
+    delete l;
     return;
   }