diff --git a/Geo/MVertexPositionSet.h b/Geo/MVertexPositionSet.h
index 91770e913fad2de7ae7ef63e0d1766ab60e5167e..f912e53ddcb00bbc962e68586585a937e27eea72 100644
--- a/Geo/MVertexPositionSet.h
+++ b/Geo/MVertexPositionSet.h
@@ -28,9 +28,10 @@ class MVertexPositionSet{
   std::vector<MVertex*> &_vertices;
  public:
   MVertexPositionSet(std::vector<MVertex*> &vertices, int maxDuplicates=10)
-    : _vertices(vertices), _maxDuplicates(maxDuplicates)
+    : _kdtree(0), _maxDuplicates(maxDuplicates), _vertices(vertices)
   {
     int totpoints = vertices.size();
+    if(!totpoints) return;
     _zeronodes = annAllocPts(totpoints, 3);
     for(int i = 0; i < totpoints; i++){
       vertices[i]->setIndex(0);
@@ -44,6 +45,7 @@ class MVertexPositionSet{
   }
   ~MVertexPositionSet()
   {
+    if(!_kdtree) return;
     delete _kdtree;
     annDeallocPts(_zeronodes);
     delete [] _index;
@@ -51,6 +53,7 @@ class MVertexPositionSet{
   }
   MVertex *find(double x, double y, double z, double tolerance)
   {
+    if(!_kdtree) return 0;
     double xyz[3] = {x, y, z};
     _kdtree->annkSearch(xyz, _maxDuplicates, _index, _dist);
     for(int i = 0; i < _maxDuplicates; i++){
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 4b51ffb710c9d281c656501d4fe803089ff0ef3e..b1040e0ff78ee3655e0638120b8f58a3c82d89cf 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1795,6 +1795,7 @@ void orientMeshGFace::operator()(GFace *gf)
 {
   gf->model()->setCurrentMeshEntity(gf);
 
+  if(gf->geomType() == GEntity::DiscreteSurface) return;
   if(gf->geomType() == GEntity::ProjectionFace) return;
   if(gf->geomType() == GEntity::CompoundSurface) return;