Index: trunk/sources/HeuristicLab.Functions/FunctionBase.cs
===================================================================
--- trunk/sources/HeuristicLab.Functions/FunctionBase.cs	(revision 528)
+++ trunk/sources/HeuristicLab.Functions/FunctionBase.cs	(revision 529)
@@ -28,4 +28,5 @@
 using HeuristicLab.DataAnalysis;
 using HeuristicLab.Constraints;
+using System.Diagnostics;
 
 namespace HeuristicLab.Functions {
@@ -80,24 +81,35 @@
     public IList<IFunction> AllowedSubFunctions(int index) {
       if(allowedSubFunctions == null) {
+        // first time: analyze the constraint and create a cached copy of the allowed sub-functions
         allowedSubFunctions = new List<IFunction>[MaxArity];
         for(int i = 0; i < MaxArity; i++) {
-          foreach(IConstraint constraint in Constraints) {
-            if(constraint is SubOperatorTypeConstraint) {
-              SubOperatorTypeConstraint subOpConstraint = constraint as SubOperatorTypeConstraint;
-              if(subOpConstraint.SubOperatorIndex.Data == i) {
-                allowedSubFunctions[i] = new List<IFunction>();
-                foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions[i].Add(f);
-                break;
-              }
-            } else if(constraint is AllSubOperatorsTypeConstraint) {
-              AllSubOperatorsTypeConstraint subOpConstraint = constraint as AllSubOperatorsTypeConstraint;
-              allowedSubFunctions[i] = new List<IFunction>();
-              foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions[i].Add(f);
-              break;
-            }
-          }
+          allowedSubFunctions[i] = GetAllowedSubFunctions(i);
         }
       }
       return allowedSubFunctions[index];
+    }
+
+    private List<IFunction> GetAllowedSubFunctions(int index) {
+      List<IFunction> allowedSubFunctions = new List<IFunction>();
+      foreach(IConstraint constraint in Constraints) {
+        if(constraint is SubOperatorTypeConstraint) {
+          SubOperatorTypeConstraint subOpConstraint = constraint as SubOperatorTypeConstraint;
+          if(subOpConstraint.SubOperatorIndex.Data == index) {
+            foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions.Add(f);
+            subOpConstraint.Changed += new EventHandler(subOpConstraint_Changed); // register an event-handler to invalidate the cache on constraing changes
+            return allowedSubFunctions;
+          }
+        } else if(constraint is AllSubOperatorsTypeConstraint) {
+          AllSubOperatorsTypeConstraint subOpConstraint = constraint as AllSubOperatorsTypeConstraint;
+          foreach(IFunction f in subOpConstraint.AllowedSubOperators) allowedSubFunctions.Add(f);
+          subOpConstraint.Changed += new EventHandler(subOpConstraint_Changed); // register an event-handler to invalidate the cache on constraint changes
+          return allowedSubFunctions;
+        }
+      }
+      return allowedSubFunctions;
+    }
+
+    private void subOpConstraint_Changed(object sender, EventArgs e) {
+      allowedSubFunctions = null;
     }
 
Index: trunk/sources/HeuristicLab.StructureIdentification/GPOperatorGroup.cs
===================================================================
--- trunk/sources/HeuristicLab.StructureIdentification/GPOperatorGroup.cs	(revision 528)
+++ trunk/sources/HeuristicLab.StructureIdentification/GPOperatorGroup.cs	(revision 529)
@@ -184,4 +184,17 @@
         if(c is SubOperatorTypeConstraint || c is AllSubOperatorsTypeConstraint) c.Changed -= new EventHandler(UpdateTreeBounds);
       }
+
+      // remove the operator from the allowed sub-functions of the remaining operators
+      foreach(IOperator o in Operators) {
+        if(o != op) {
+          foreach(IConstraint c in o.Constraints) {
+            if(c is SubOperatorTypeConstraint) {
+              ((SubOperatorTypeConstraint)c).RemoveOperator(op);
+            } else if(c is AllSubOperatorsTypeConstraint) {
+              ((AllSubOperatorsTypeConstraint)c).RemoveOperator(op);
+            }
+          }
+        }
+      }
       OnOperatorRemoved(op);
     }
