diff --git a/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp b/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
index a35dca0f875ee86d320001f179e1ad65d8c2acff..a1c81763bb9bb4b38cda83ec51d54401008cf65f 100644
--- a/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
+++ b/MeshGeoToolsLib/BoundaryElementsAlongPolyline.cpp
@@ -34,14 +34,7 @@ BoundaryElementsAlongPolyline::BoundaryElementsAlongPolyline(MeshLib::Mesh const
 	for (auto ele_id : ele_ids_near_ply) {
 		auto* e = _mesh.getElement(ele_id);
 		// skip internal elements
-		bool isOuterElement = false;
-		for (unsigned i=0; i<e->getNNeighbors(); i++) {
-			if (!e->getNeighbor(i)) {
-				isOuterElement = true;
-				break;
-			}
-		}
-		if (!isOuterElement)
+		if (!e->isBoundaryElement())
 			continue;
 		// find edges on the polyline
 		for (unsigned i=0; i<e->getNEdges(); i++) {
diff --git a/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp b/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
index 5ebefefcaa51c8ae822fb49806a103f23b20f566..e6ddc9241f50636def41845e9ce0868abc7b681a 100644
--- a/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
+++ b/MeshGeoToolsLib/BoundaryElementsOnSurface.cpp
@@ -26,18 +26,11 @@ BoundaryElementsOnSurface::BoundaryElementsOnSurface(MeshLib::Mesh const& mesh,
 	auto node_ids_on_sfc = mshNodeSearcher.getMeshNodeIDsAlongSurface(sfc);
 	auto ele_ids_near_sfc = MeshLib::getConnectedElementIDs(_mesh, node_ids_on_sfc);
 
-	// get a list of edges made of the nodes
+	// get a list of faces made of the nodes
 	for (auto ele_id : ele_ids_near_sfc) {
 		auto* e = _mesh.getElement(ele_id);
 		// skip internal elements
-		bool isOuterElement = false;
-		for (unsigned i=0; i<e->getNNeighbors(); i++) {
-			if (!e->getNeighbor(i)) {
-				isOuterElement = true;
-				break;
-			}
-		}
-		if (!isOuterElement)
+		if (!e->isBoundaryElement())
 			continue;
 		// find faces on surface
 		for (unsigned i=0; i<e->getNFaces(); i++) {