diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp
index 8facfabae564251a20676f1ec3f2ab623a959605..f803e229bd731ddb494de1905fd89b67bf4e7ce5 100644
--- a/Mesh/meshGFaceLloyd.cpp
+++ b/Mesh/meshGFaceLloyd.cpp
@@ -418,6 +418,8 @@ smoothing::smoothing(int param1,int param2){
 }
 
 void smoothing::optimize_face(GFace* gf){
+  if(gf->getNumMeshElements()==0 || gf->getCompound()) return;
+	
   std::set<MVertex*> all;
 
   // get all the points of the face ...
@@ -590,6 +592,8 @@ void smoothing::optimize_face(GFace* gf){
 	
   free(initial_conditions);
   free(variables_scales);
+	
+  backgroundMesh::unset();
 }
 
 void smoothing::optimize_model(){