diff --git a/src/algebra/CRSMatrix.hpp b/src/algebra/CRSMatrix.hpp
index bf650afe2784035023fbb5311c1c3a12c68b2a3b..1f7fe37e571447b104b81ff61cf38dcf2144d897 100644
--- a/src/algebra/CRSMatrix.hpp
+++ b/src/algebra/CRSMatrix.hpp
@@ -1,11 +1,11 @@
 #ifndef CRS_MATRIX_HPP
 #define CRS_MATRIX_HPP
 
+#include <algebra/Vector.hpp>
 #include <utils/Array.hpp>
+#include <utils/NaNHelper.hpp>
 #include <utils/PugsAssert.hpp>
 
-#include <algebra/Vector.hpp>
-
 #include <iostream>
 
 template <typename DataType, typename IndexType>
@@ -100,7 +100,7 @@ class CRSMatrix
       const auto row_end   = A.m_row_map[i + 1];
       os << i << "|";
       for (IndexType j = row_begin; j < row_end; ++j) {
-        os << ' ' << A.m_column_indices[j] << ':' << A.m_values[j];
+        os << ' ' << A.m_column_indices[j] << ':' << NaNHelper(A.m_values[j]);
       }
       os << '\n';
     }