diff --git a/pystencils/simp/assignment_collection.py b/pystencils/simp/assignment_collection.py
index f493b08e931bf69f0b9713255c0eee87e9bace66..07d29f3dcb467285c601689819325016bc18be06 100644
--- a/pystencils/simp/assignment_collection.py
+++ b/pystencils/simp/assignment_collection.py
@@ -303,7 +303,7 @@ class AssignmentCollection:
             if eq.lhs in symbols_to_extract:
                 new_assignments.append(eq)
 
-        new_sub_expr = [eq for eq in self.subexpressions
+        new_sub_expr = [eq for eq in self.all_assignments
                         if eq.lhs in dependent_symbols and eq.lhs not in symbols_to_extract]
         return self.copy(new_assignments, new_sub_expr)