diff --git a/CMakeModules/testing_cpp.cmake b/CMakeModules/testing_cpp.cmake
index 95364659d91c2e92923eee675303f57f51e86506..413b20be1c2cf37a15eb1bd5b8a2615deb9c0a90 100644
--- a/CMakeModules/testing_cpp.cmake
+++ b/CMakeModules/testing_cpp.cmake
@@ -105,8 +105,10 @@ function(gtest target test_source_files linktarget)
         set_tests_properties(test-${target} PROPERTIES LABELS "unit;all")
 
         message(STATUS "Added test 'test-${target}'")
-
-        if (CMAKE_COMPILER_IS_GNUCXX)
+        if (ARGN)
+            LIST(GET ${ARGN} 0 NOCOV)
+        endif()
+        if (CMAKE_COMPILER_IS_GNUCXX AND NOT 1${NOCOV} STREQUAL "1nocov")
             set(COVERAGE_EXCLUDES "*/unittests/*" "*/3d_party/*" "*/python/*")
             if (ARGN)
                 set(COVERAGE_EXCLUDES ${COVERAGE_EXCLUDES} ${ARGN})
@@ -116,6 +118,8 @@ function(gtest target test_source_files linktarget)
                     COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
                     coverage-${target} ${CMAKE_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE})
             set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all")
+            message(STATUS "Added test 'test-${target}-coverage'")
+
             SET_TESTS_PROPERTIES(coveragetest-${target} PROPERTIES DEPENDS test-${target})
             set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE)
             set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)
diff --git a/common/cpp/src/database/CMakeLists.txt b/common/cpp/src/database/CMakeLists.txt
index 7de3686fd366dd346d15d2d8b25539f938bbe9c1..eda63f850608b08872b79c147ee887f7852a473d 100644
--- a/common/cpp/src/database/CMakeLists.txt
+++ b/common/cpp/src/database/CMakeLists.txt
@@ -27,5 +27,5 @@ set(TEST_SOURCE_FILES ../../unittests/database/test_encoding.cpp)
 set(TEST_LIBRARIES "${TARGET_NAME}")
 
 include_directories(${ASAPO_CXX_COMMON_INCLUDE_DIR})
-gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "*mongodb_client*" "*database.*")
+gtest(${TARGET_NAME} "${TEST_SOURCE_FILES}" "${TEST_LIBRARIES}" "nocov")
 
diff --git a/common/cpp/src/database/encoding.cpp b/common/cpp/src/database/encoding.cpp
index c8cf596f0bfdc64764ca147124e1ebcf5ca4db8d..0ce365ea24a1eee20d191302adc60fd3d4a85897 100644
--- a/common/cpp/src/database/encoding.cpp
+++ b/common/cpp/src/database/encoding.cpp
@@ -85,9 +85,14 @@ std::string EncodeColName(const std::string &colname) {
 }
 
 std::string DecodeName(const std::string &name) {
-    std::unique_ptr<char>decoded{new char(name.size())};
-    auto res = decode(name.c_str(), decoded.get());
-    return res >= 0 ? decoded.get() : "";
+    char* decoded = new char[name.size() + 1];
+    auto res = decode(name.c_str(), decoded);
+    if (res < 0) {
+        return "";
+    }
+    std::string str = std::string{decoded};
+    delete[] decoded;
+    return str;
 }
 
 bool ShouldEscapeQuery(char c) {