Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/HeuristicLab.NativeInterpreter-0.1.csproj
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/HeuristicLab.NativeInterpreter-0.1.csproj	(revision 17072)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/HeuristicLab.NativeInterpreter-0.1.csproj	(revision 17073)
@@ -39,9 +39,4 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -69,4 +64,11 @@
     </Content>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17072)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs	(revision 17073)
@@ -36,5 +36,4 @@
       Parameters.Add(new FixedValueParameter<IntValue>(EvaluatedSolutionsParameterName, "A counter for the total number of solutions the interpreter has evaluated", new IntValue(0)));
     }
-
 
     [StorableConstructor]
@@ -175,8 +174,14 @@
     }
 
+    private readonly object syncRoot = new object();
+
     [ThreadStatic]
     private Dictionary<string, double[]> cachedData;
 
+    [ThreadStatic]
+    private IDataset dataset;
+
     private void InitCache(IDataset dataset) {
+      this.dataset = dataset;
       cachedData = new Dictionary<string, double[]>();
       foreach (var v in dataset.DoubleVariables) {
@@ -187,14 +192,17 @@
     public void InitializeState() {
       cachedData = null;
+      dataset = null;
       EvaluatedSolutions = 0;
     }
 
     private double[] GetValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
+      if (cachedData == null || this.dataset != dataset) {
+        InitCache(dataset);
+      }
+
       var code = Compile(tree, dataset, OpCodes.MapSymbolToOpCode);
       var remainingRows = rows.Length % BATCHSIZE;
       var roundedTotal = rows.Length - remainingRows;
 
-      // TODO: evaluated solutions are not counted
-
       var result = new double[rows.Length];
 
@@ -209,11 +217,13 @@
       }
 
+      // when evaluation took place without any error, we can increment the counter
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+
       return result;
     }
 
     public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) {
-      if (cachedData == null) {
-        InitCache(dataset);
-      }
       return GetValues(tree, dataset, rows);
     }
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17072)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs	(revision 17073)
@@ -59,5 +59,4 @@
     protected SymbolicDataAnalysisExpressionTreeNativeInterpreter(bool deserializing) : base(deserializing) { }
 
-
     protected SymbolicDataAnalysisExpressionTreeNativeInterpreter(SymbolicDataAnalysisExpressionTreeNativeInterpreter original, Cloner cloner) : base(original, cloner) {
     }
@@ -99,12 +98,11 @@
     private static Dictionary<string, GCHandle> cachedData;
 
+    [ThreadStatic]
+    private IDataset dataset;
+
     public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) {
       if (!rows.Any()) return Enumerable.Empty<double>();
 
-      lock (syncRoot) {
-        EvaluatedSolutions++; // increment the evaluated solutions counter
-      }
-
-      if (cachedData == null) {
+      if (cachedData == null || this.dataset != dataset) {
         InitCache(dataset);
       }
@@ -116,8 +114,25 @@
 
       NativeWrapper.GetValuesVectorized(code, code.Length, rowsArray, rowsArray.Length, result);
+
+      // when evaluation took place without any error, we can increment the counter
+      lock (syncRoot) {
+        EvaluatedSolutions++;
+      }
+
       return result;
     }
 
     private void InitCache(IDataset dataset) {
+      this.dataset = dataset;
+
+      // free handles to old data
+      if (cachedData != null) {
+        foreach (var gch in cachedData.Values) {
+          gch.Free();
+        }
+        cachedData = null;
+      }
+
+      // cache new data
       cachedData = new Dictionary<string, GCHandle>();
       foreach (var v in dataset.DoubleVariables) {
@@ -135,4 +150,5 @@
         cachedData = null;
       }
+      dataset = null;
       EvaluatedSolutions = 0;
     }
