diff --git a/src/utils/checkpointing/Checkpoint.cpp b/src/utils/checkpointing/Checkpoint.cpp
index e9fe8ccd2a4eb580812cde6e1cf3a39977f85a10..ffd8c1c4649a521f2d0ca247c9a44d9cbd3c4297 100644
--- a/src/utils/checkpointing/Checkpoint.cpp
+++ b/src/utils/checkpointing/Checkpoint.cpp
@@ -51,6 +51,20 @@ checkpoint()
               << rang::fgB::yellow << ASTExecutionStack::getInstance().currentNode().begin().line << rang::fg::reset
               << " [using " << rang::fgB::cyan << checkpoint_name << rang::fg::reset << "]\n";
 
+    if (checkpoint_number > 0) {
+      uint64_t resuming_checkpoint_number =
+        file.getGroup("resuming_checkpoint").getAttribute("checkpoint_number").read<uint64_t>();
+      uint64_t last_checkpoint_number =
+        file.getGroup("last_checkpoint").getAttribute("checkpoint_number").read<uint64_t>();
+      for (uint64_t i = resuming_checkpoint_number + 1; i <= last_checkpoint_number; ++i) {
+        std::string old_checkpoint_name = "checkpoint_" + std::to_string(i);
+        std::cout << "   - removing deprecated " << rang::fgB::yellow << old_checkpoint_name << rang::fg::reset << '\n';
+        if (file.exist(old_checkpoint_name)) {
+          file.unlink(old_checkpoint_name);
+        }
+      }
+    }
+
     HighFive::Group checkpoint = file.createGroup(checkpoint_name);
 
     uint64_t checkpoint_id =
@@ -68,6 +82,9 @@ checkpoint()
     checkpoint.createAttribute("id", checkpoint_id);
     checkpoint.createAttribute("data.pgs", ASTExecutionStack::getInstance().fileContent());
 
+    checkpoint.createAttribute("checkpoint_number", checkpoint_number);
+    ++checkpoint_number;
+
     {
       HighFive::Group global_variables_group = checkpoint.createGroup("singleton/global_variables");
       global_variables_group.createAttribute("connectivity_id", GlobalVariableManager::instance().getConnectivityId());
@@ -209,13 +226,6 @@ checkpoint()
       file.unlink("resuming_checkpoint");
     }
     file.createHardLink("resuming_checkpoint", checkpoint);
-
-    if (file.hasAttribute("checkpoint_number")) {
-      file.deleteAttribute("checkpoint_number");
-    }
-    file.createAttribute("checkpoint_number", checkpoint_number);
-
-    ++checkpoint_number;
   }
   catch (HighFive::Exception& e) {
     throw NormalError(e.what());
diff --git a/src/utils/checkpointing/Resume.cpp b/src/utils/checkpointing/Resume.cpp
index a4991f10e09effc0ffc591a6251dc25427a6c3f6..dbb539771547fc485cbb3642a9a3b24216fd907c 100644
--- a/src/utils/checkpointing/Resume.cpp
+++ b/src/utils/checkpointing/Resume.cpp
@@ -37,7 +37,7 @@ resume()
 
     ResumingManager& resuming_manager = ResumingManager::getInstance();
 
-    resuming_manager.checkpointNumber() = file.getAttribute("checkpoint_number").read<uint64_t>() + 1;
+    resuming_manager.checkpointNumber() = checkpoint.getAttribute("checkpoint_number").read<uint64_t>() + 1;
 
     std::cout << " * " << rang::fgB::green << "Resuming " << rang::fg::reset << "execution at line "
               << rang::fgB::yellow << p_node->begin().line << rang::fg::reset << " [using " << rang::fgB::cyan