diff --git a/hercules_ir/src/fork_join_analysis.rs b/hercules_ir/src/fork_join_analysis.rs
index 88d700aa7940dad960a0f929600763df03bdad84..3e89ae90ead672ab1092531e950b5f741b16d5bf 100644
--- a/hercules_ir/src/fork_join_analysis.rs
+++ b/hercules_ir/src/fork_join_analysis.rs
@@ -177,7 +177,7 @@ pub fn nodes_in_fork_joins(
         let mut set = HashSet::new();
         set.insert(*fork);
 
-        // Iterate uses of fork.
+        // Iterate uses of the fork.
         while let Some(item) = worklist.pop() {
             for u in def_use.get_users(item) {
                 let terminate = *u == *join
@@ -189,11 +189,15 @@ pub fn nodes_in_fork_joins(
                     worklist.push(*u);
                 }
                 set.insert(*u);
+            }
+        }
+        assert!(set.contains(join));
 
-                // Nodes in reduce cycles might not depend on the thread ID.
-                if terminate && let Some(cycle) = reduce_cycles.get(u) {
-                    set.extend(cycle);
-                }
+        // Add all the nodes in the reduce cycle. Some of these nodes may not
+        // use thread IDs of the fork, so do this explicitly.
+        for u in def_use.get_users(*join) {
+            if let Some(cycle) = reduce_cycles.get(u) {
+                set.extend(cycle);
             }
         }
 
diff --git a/hercules_opt/src/editor.rs b/hercules_opt/src/editor.rs
index 8c339d728bf3e139a8960673fcd687806c7def70..16e5c3264d33a7c9bef85fc0fa3cec02963dbf48 100644
--- a/hercules_opt/src/editor.rs
+++ b/hercules_opt/src/editor.rs
@@ -292,7 +292,11 @@ impl<'a: 'b, 'b> FunctionEditor<'a> {
             // gravestone.
             for id in deleted_nodeids.iter() {
                 // Check that there are no users of deleted nodes.
-                assert!(editor.mut_def_use[id.idx()].is_empty());
+                assert!(
+                    editor.mut_def_use[id.idx()].is_empty(),
+                    "PANIC: Attempted to delete node {:?}, but there are still users of this node ({:?}).",
+                    id, editor.mut_def_use[id.idx()]
+                );
                 editor.function.nodes[id.idx()] = Node::Start;
             }