diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 1e2410e235862b468baa6476ec7b5feee4db3399..f3769ba278a2a7e01de95ea8598bf9a5865fedb4 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -520,20 +520,21 @@ static void Mesh2D(GModel *m)
   }
 
 #if defined(HAVE_BFGS)
-  // lloyd optimization
-  if (CTX::instance()->mesh.optimizeLloyd){
+  //lloyd optimization
+  if(CTX::instance()->mesh.optimizeLloyd){
     for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
-      if((*it)->geomType()==GEntity::CompoundSurface || (*it)->geomType()==GEntity::Plane){
-	smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
-	m->writeMSH("beforeLLoyd.msh");
-	smm.optimize_face(*it);
-	//int rec = 1;//(CTX::instance()->mesh.recombineAll ||
-        //              (*it)->meshAttributes.recombine);
-	m->writeMSH("afterLLoyd.msh");
-	//if(rec) recombineIntoQuads(*it);
-	//m->writeMSH("afterRecombine.msh");
-      }
-    }
+	  if((*it)->geomType()==GEntity::CompoundSurface || (*it)->geomType()==GEntity::Plane){
+		if((*it)->meshAttributes.method != MESH_TRANSFINITE){
+	      smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
+		  //m->writeMSH("beforeLLoyd.msh");
+		  smm.optimize_face(*it);
+		  int rec = ((CTX::instance()->mesh.recombineAll || (*it)->meshAttributes.recombine) && !CTX::instance()->mesh.recombine3DAll);
+		  //m->writeMSH("afterLLoyd.msh");
+		  if(rec) recombineIntoQuads(*it);
+		  //m->writeMSH("afterRecombine.msh");
+		}
+	  }
+	}
     /*
     for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
       GFace *gf = *it;