diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp
index dfc2b96aaaf67df2f3be877b278a5a03608a6585..afa1ac054d0738e8b9074fefd39e1bc1e89035bf 100644
--- a/GeoLib/GEOObjects.cpp
+++ b/GeoLib/GEOObjects.cpp
@@ -418,13 +418,13 @@ bool GEOObjects::mergePoints(std::vector<std::string> const & geo_names,
 			continue;
 		}
 
-		std::string tmp_name;
 		std::size_t const n_pnts(pnts->size());
 		for (std::size_t k(0); k < n_pnts; ++k) {
 			merged_points->push_back(new GeoLib::Point(*(*pnts)[k]));
-			if (pnt_vec->getNameOfElementByID(k, tmp_name)) {
+			std::string const& item_name(pnt_vec->getItemNameByID(k));
+			if (! item_name.empty()) {
 				merged_pnt_names->insert(
-					std::make_pair(tmp_name, pnt_offsets[j] + k));
+					std::make_pair(item_name, pnt_offsets[j] + k));
 			}
 		}
 		if (n_geo_names - 1 > j) {