diff --git a/dune/tectonic/data-structures/program_state.hh b/dune/tectonic/data-structures/program_state.hh
index 6c6f3875a11e2ea0dc289f3ccb8a503a26cd4f4a..b409285048452c70069e6fc21a788bced4d5718d 100644
--- a/dune/tectonic/data-structures/program_state.hh
+++ b/dune/tectonic/data-structures/program_state.hh
@@ -159,8 +159,9 @@ template <class VectorTEMPLATE, class ScalarVectorTEMPLATE> class ProgramState {
         const auto& body = *contactNetwork.body(i);
 
         if (body.data()->getYoungModulus() == 0.0) {
-            for (; dof<body.nVertices(); dof++) {
+            for (size_t j=0; j<body.nVertices(); j++) {
                 dirichletNodes[dof] = true;
+                dof++;
             }
         } else {
             dof += body.nVertices();