Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs	(revision 3540)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs	(revision 3541)
@@ -40,34 +40,60 @@
   [Item("DefaultSymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
   public class DefaultSymbolicExpressionGrammar : Item, ISymbolicExpressionGrammar {
-    [Storable]
+
+    #region properties for separation between implementation and persistence
+    [Storable]
+    private IEnumerable<KeyValuePair<string, int>> MinSubTreeCount {
+      get { return minSubTreeCount.AsEnumerable(); }
+      set { minSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+
+    [Storable]
+    private IEnumerable<KeyValuePair<string, int>> MaxSubTreeCount {
+      get { return maxSubTreeCount.AsEnumerable(); }
+      set { maxSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+
+    [Storable]
+    private IEnumerable<KeyValuePair<string, IEnumerable<IEnumerable<string>>>> AllowedChildSymbols {
+      get {
+        return (from parentEntry in allowedChildSymbols
+                let setEnumeration = parentEntry.Value.Select(set => set.AsEnumerable()).ToList()
+                select new KeyValuePair<string, IEnumerable<IEnumerable<string>>>(parentEntry.Key, setEnumeration))
+                .ToList();
+      }
+      set {
+        allowedChildSymbols = new Dictionary<string, List<HashSet<string>>>();
+        foreach (var pair in value) {
+          allowedChildSymbols[pair.Key] = new List<HashSet<string>>();
+          foreach (var entry in pair.Value) {
+            var hashSet = new HashSet<string>();
+            foreach (string child in entry) {
+              hashSet.Add(child);
+            }
+            allowedChildSymbols[pair.Key].Add(hashSet);
+          }
+        }
+      }
+    }
+    [Storable]
+    private IEnumerable<KeyValuePair<string, Symbol>> AllSymbols {
+      get { return allSymbols.AsEnumerable(); }
+      set { allSymbols = value.ToDictionary(x => x.Key, x => x.Value); }
+    }
+    #endregion
+
     private Dictionary<string, int> minSubTreeCount;
-    [Storable]
     private Dictionary<string, int> maxSubTreeCount;
-    [Storable]
     private Dictionary<string, List<HashSet<string>>> allowedChildSymbols;
-    [Storable]
     private Dictionary<string, Symbol> allSymbols;
+    [Storable]
+    private Symbol startSymbol;
 
     public DefaultSymbolicExpressionGrammar()
       : base() {
-      Reset();
-    }
-
-    private void Initialize() {
-      startSymbol = new StartSymbol();
-      AddSymbol(startSymbol);
-      SetMinSubtreeCount(startSymbol, 1);
-      SetMaxSubtreeCount(startSymbol, 1);
-    }
-
-    #region ISymbolicExpressionGrammar Members
-
-    private Symbol startSymbol;
-    public Symbol StartSymbol {
-      get { return startSymbol; }
-      set { startSymbol = value; }
-    }
-
-    protected void Reset() {
+      Clear();
+    }
+
+    public void Clear() {
       minSubTreeCount = new Dictionary<string, int>();
       maxSubTreeCount = new Dictionary<string, int>();
@@ -77,6 +103,18 @@
       cachedMaxExpressionLength = new Dictionary<string, int>();
       cachedMinExpressionDepth = new Dictionary<string, int>();
-      Initialize();
-    }
+
+      startSymbol = new StartSymbol();
+      AddSymbol(startSymbol);
+      SetMinSubtreeCount(startSymbol, 1);
+      SetMaxSubtreeCount(startSymbol, 1);
+    }
+
+    #region ISymbolicExpressionGrammar Members
+
+    public Symbol StartSymbol {
+      get { return startSymbol; }
+      set { startSymbol = value; }
+    }
+
 
     public void AddSymbol(Symbol symbol) {
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs	(revision 3540)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs	(revision 3541)
@@ -40,5 +40,5 @@
       set { 
         minFunctionDefinitions = value;
-        Reset();
+        Initialize();
       }
     }
@@ -49,5 +49,5 @@
       set { 
         maxFunctionDefinitions = value;
-        Reset();
+        Initialize();
       }
     }
@@ -58,5 +58,5 @@
       set { 
         minFunctionArguments = value;
-        Reset();
+        Initialize();
       }
     }
@@ -67,5 +67,5 @@
       set { 
         maxFunctionArguments = value;
-        Reset();
+        Initialize();
       }
     }
@@ -83,15 +83,7 @@
     }
 
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserializationHook() {
-      Reset();
-    }
+    private void Initialize() {
+      base.Clear();
 
-    private new void Reset() {
-      base.Reset();
-      Initialize();
-    }
-
-    private void Initialize() {
       // remove the start symbol of the default grammar
       RemoveSymbol(StartSymbol);
@@ -107,34 +99,36 @@
       SetMaxSubtreeCount(defunSymbol, 1);
 
-      // copy symbols from mainBranchGrammar
-      foreach (var symb in mainBranchGrammar.Symbols) {
-        AddSymbol(symb);
-        SetMinSubtreeCount(symb, mainBranchGrammar.GetMinSubtreeCount(symb));
-        SetMaxSubtreeCount(symb, mainBranchGrammar.GetMaxSubtreeCount(symb));
-      }
+      if (mainBranchGrammar != null) {
+        // copy symbols from mainBranchGrammar
+        foreach (var symb in mainBranchGrammar.Symbols) {
+          AddSymbol(symb);
+          SetMinSubtreeCount(symb, mainBranchGrammar.GetMinSubtreeCount(symb));
+          SetMaxSubtreeCount(symb, mainBranchGrammar.GetMaxSubtreeCount(symb));
+        }
 
-      // the start symbol of the mainBranchGrammar is allowed as the result producing branch
-      SetAllowedChild(StartSymbol, mainBranchGrammar.StartSymbol, 0);
+        // the start symbol of the mainBranchGrammar is allowed as the result producing branch
+        SetAllowedChild(StartSymbol, mainBranchGrammar.StartSymbol, 0);
 
-      // ADF branches maxFunctionDefinitions 
-      for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
-        SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
-      }
+        // ADF branches maxFunctionDefinitions 
+        for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
+          SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
+        }
 
-      // copy syntax constraints from mainBranchGrammar
-      foreach (var parent in mainBranchGrammar.Symbols) {
-        for (int i = 0; i < mainBranchGrammar.GetMaxSubtreeCount(parent); i++) {
-          foreach (var child in mainBranchGrammar.Symbols) {
-            if (mainBranchGrammar.IsAllowedChild(parent, child, i)) {
-              SetAllowedChild(parent, child, i);
+        // copy syntax constraints from mainBranchGrammar
+        foreach (var parent in mainBranchGrammar.Symbols) {
+          for (int i = 0; i < mainBranchGrammar.GetMaxSubtreeCount(parent); i++) {
+            foreach (var child in mainBranchGrammar.Symbols) {
+              if (mainBranchGrammar.IsAllowedChild(parent, child, i)) {
+                SetAllowedChild(parent, child, i);
+              }
             }
           }
         }
-      }
 
-      // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
-      foreach (var symb in mainBranchGrammar.Symbols) {
-        if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
-          SetAllowedChild(defunSymbol, symb, 0);
+        // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
+        foreach (var symb in mainBranchGrammar.Symbols) {
+          if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
+            SetAllowedChild(defunSymbol, symb, 0);
+        }
       }
     }
Index: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 3540)
+++ trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs	(revision 3541)
@@ -36,5 +36,5 @@
   public class SymbolicExpressionTreeNode : ICloneable {
     [Storable]
-    private List<SymbolicExpressionTreeNode> subTrees;
+    private IList<SymbolicExpressionTreeNode> subTrees;
     [Storable]
     private Symbol symbol;
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs	(revision 3540)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs	(revision 3541)
@@ -50,8 +50,12 @@
       get { return interpreter; }
     }
+    private List<string> inputVariables;
     [Storable]
-    private List<string> inputVariables;
     public IEnumerable<string> InputVariables {
       get { return inputVariables.AsEnumerable(); }
+      set {
+        if (value != null)
+          inputVariables = new List<string>(value);
+      }
     }
     public SymbolicRegressionModel() : base() { } // for cloning
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs	(revision 3540)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs	(revision 3541)
@@ -66,6 +66,6 @@
       }
     }
+    private List<string> variableNames;
     [Storable]
-    private List<string> variableNames;
     public IEnumerable<string> VariableNames {
       get { return variableNames; }
