diff --git a/hercules_ir/src/schedule.rs b/hercules_ir/src/schedule.rs
index 57136c0cf4149f5b7a3e4f760375f0d941be8c9a..ab1b4f51a5dd95358a4a440ef39707c985734b48 100644
--- a/hercules_ir/src/schedule.rs
+++ b/hercules_ir/src/schedule.rs
@@ -62,7 +62,7 @@ pub fn default_plan(function: &Function, fork_join_map: &HashMap<NodeID, NodeID>
             control,
             init: _,
             reduct,
-        } = function.nodes[id.idx()]
+        } = function.nodes[chain_id.idx()]
         {
             if first_control.is_none() {
                 first_control = Some(control);