diff --git a/Solver/linearSystemCSR.cpp b/Solver/linearSystemCSR.cpp
index 8b00158f197f95fc80365faf3ca531260177e074..898910ba6a09f9d83eb6dd785d2c35cf6afa1e9f 100644
--- a/Solver/linearSystemCSR.cpp
+++ b/Solver/linearSystemCSR.cpp
@@ -272,7 +272,8 @@ void sortColumns_(int NbLines, int nnz, INDEX_TYPE *ptr, INDEX_TYPE *jptr,
     for (int j = jptr[i]; j < jptr[i + 1] - 1; j++){
       ptr[j] = j + 1;
     }
-    //    ptr[jptr[i + 1]] = 0;
+    if (jptr[i + 1] != jptr[i])
+      ptr[jptr[i + 1] - 1] = 0;
   }
 
   delete[] count;