diff --git a/.gitlab/ci/analysis.gitlab-ci.yml b/.gitlab/ci/analysis.gitlab-ci.yml
index aceb88d9c45aed0c4546c37a1466fed6007f48d2..626ee475990245a40ecadb59d63d30e0cc690134 100644
--- a/.gitlab/ci/analysis.gitlab-ci.yml
+++ b/.gitlab/ci/analysis.gitlab-ci.yml
@@ -23,7 +23,7 @@ cppcheck_report:
     - yum -y install python3-pip
     - python3 -m pip install -U cppcheck_codequality
     - cppcheck-codequality --input-file=cppcheck_out.xml --output-file=cppcheck.json
-    - if cat cppcheck_out.xml | grep -q "\"error\""; then echo "ERRORS have been detected"; exit 1; fi;
+    - if cat cppcheck_out.xml | grep -q "<error\s"; then echo "ERRORS have been detected"; exit 1; fi;
   artifacts:
     reports:
       codequality: cppcheck.json
diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index fbcc77f8d25295f240c7a1cdbc9475a5cb50254a..96daf483aacdce1687454d20f4a148aaef6af7c6 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -1,3 +1,10 @@
+# v4.NEXT
+
+## Summary
+### Bug fixes
+- cta/CTA#160 - Improve DB access to get all the Tape Drive States
+- cta/CTA#164 - Cppcheck job is not failing when there are errors
+
 # v4.7.11-1
 
 ## Summary
diff --git a/common/Configuration.hpp b/common/Configuration.hpp
index 347de4c91e354c04dc55dcbad3757e34f1849801..07a4b7eef1fc02aa44ec32f2d22b2bc3281a844a 100644
--- a/common/Configuration.hpp
+++ b/common/Configuration.hpp
@@ -152,7 +152,7 @@ namespace cta { namespace common {
 
         T value;
         std::stringstream ss;
-        ss << strValue.c_str();
+        ss << strValue;
         ss >> value;
 
         if(nullptr != log) {
@@ -193,7 +193,7 @@ namespace cta { namespace common {
 
         T value;
         std::stringstream ss;
-        ss << strValue.c_str();
+        ss << strValue;
         ss >> value;
 
         if(nullptr != log) {
diff --git a/common/dataStructures/Tape.cpp b/common/dataStructures/Tape.cpp
index e24154bd477f0945952b7905aa8496ca2eed22ad..6ae2849630292a95d981e9afc2306528a4ae8fba 100644
--- a/common/dataStructures/Tape.cpp
+++ b/common/dataStructures/Tape.cpp
@@ -55,7 +55,7 @@ std::string Tape::getAllPossibleStates(){
     ret += kv.first + " ";
   }
   if(ret.size())
-    ret = ret.substr(0,ret.size() - 1);
+    ret.pop_back();
   return ret;
 }
 
diff --git a/common/dataStructures/TapeDrive.cpp b/common/dataStructures/TapeDrive.cpp
index 818918d47693098fe97434e6e9bbc01f841fe4c4..07a01e822bf818e7dd6306c23d0025386dd2f885 100644
--- a/common/dataStructures/TapeDrive.cpp
+++ b/common/dataStructures/TapeDrive.cpp
@@ -69,7 +69,7 @@ std::string TapeDrive::getAllPossibleStates(){
     ret += kv.first + " ";
   }
   if(ret.size())
-    ret = ret.substr(0,ret.size() - 1);
+    ret.pop_back();
   return ret;
 }
 
diff --git a/rdbms/Login.cpp b/rdbms/Login.cpp
index dac6480b73b52b9c044de9afe0654f9191ba5f17..c81b90b9ec2d71b98bd73b817d02a9e7cd26f5f9 100644
--- a/rdbms/Login.cpp
+++ b/rdbms/Login.cpp
@@ -158,7 +158,7 @@ std::list<std::string> Login::readNonEmptyLines(std::istream &inputStream) {
     {
       const std::string::size_type newlinePos = line.find("\n");
       if (newlinePos != std::string::npos) {
-        line = line.substr(0, newlinePos);
+        line.resize(newlinePos);
       }
     }