diff --git a/SpMat.h b/SpMat.h
index ae81cc6fb155164c2ff91d1d8e3f1f7d8bed6210..8734f62820b8026511973906a51a3c305d0e3554 100644
--- a/SpMat.h
+++ b/SpMat.h
@@ -39,10 +39,10 @@ class SpMatException: public std::exception
 private:
   std::string m_msg;
 public:
-  SpMatException(const std::string& msg) throw(): m_msg(msg) {}
+  SpMatException(const std::string& msg) throw(): m_msg(std::string("SpMat::")+msg) {}
 
   virtual const char * what() const throw() {
-    return std::string("SpMat::" + m_msg).c_str();
+    return(m_msg.c_str());
   }
 
   ~SpMatException() throw() {}
diff --git a/bfmatrix.h b/bfmatrix.h
index 92ef6e39cdd64155632cbf8ed985cd0d0088c39a..1db88105d16b3fb383e4e9e9636201bf5fc0414c 100644
--- a/bfmatrix.h
+++ b/bfmatrix.h
@@ -42,10 +42,10 @@ class BFMatrixException: public std::exception
 private:
   std::string m_msg;
 public:
-  BFMatrixException(const std::string& msg) throw(): m_msg(msg) {}
+  BFMatrixException(const std::string& msg) throw(): m_msg(std::string("BFMatrix::")+msg) {}
 
   virtual const char * what() const throw() {
-    return std::string("BFMatrix::" + m_msg).c_str();
+    return(m_msg.c_str());
   }
 
   ~BFMatrixException() throw() {}
diff --git a/nonlin.h b/nonlin.h
index a0d0fdfa658471cba04212a932dbeec5c1057b84..4e8b17a5f0300acd7dde75e687123d83ee4a3096 100644
--- a/nonlin.h
+++ b/nonlin.h
@@ -65,10 +65,10 @@ class NonlinException: public std::exception
 private:
   std::string m_msg;
 public:
-  NonlinException(const std::string& msg) throw(): m_msg(msg) {}
+  NonlinException(const std::string& msg) throw(): m_msg(std::string("Nonlin: msg=")+msg) {}
 
   virtual const char * what() const throw() {
-    return std::string("Nonlin: msg=" + m_msg).c_str();
+    return(m_msg.c_str());
   }
 
   ~NonlinException() throw() {}