Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Problem.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Problem.cs	(revision 1214)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Problem.cs	(revision 1215)
@@ -52,8 +52,4 @@
     public HeuristicLab.DataAnalysis.Dataset DataSet {
       get { return dataset; }
-    }
-
-    public string[] VariableNames {
-      get { return DataSet.VariableNames; }
     }
 
@@ -123,4 +119,9 @@
     }
 
+
+    public string GetVariableName(int index) {
+      return dataset.GetVariableName(index);
+    }
+
     public override IView CreateView() {
       return new ProblemView(this);
@@ -177,5 +178,5 @@
       AutoRegressive = bool.Parse(node.Attributes["AutoRegressive"].Value);
       allowedTargetVariables.Clear();
-      foreach (string tok in node.SelectSingleNode("AllowedTargetVariables").InnerText.Split(new string[]{";"}, StringSplitOptions.RemoveEmptyEntries))
+      foreach (string tok in node.SelectSingleNode("AllowedTargetVariables").InnerText.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
         allowedTargetVariables.Add(int.Parse(tok));
       allowedInputVariables.Clear();
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.cs	(revision 1214)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ProblemView.cs	(revision 1215)
@@ -64,6 +64,6 @@
       inputsListBox.Items.Clear();
       for (int i = 0; i < problem.DataSet.Columns; i++) {
-        targetsListBox.Items.Add(problem.DataSet.VariableNames[i], problem.AllowedTargetVariables.Contains(i));
-        inputsListBox.Items.Add(problem.DataSet.VariableNames[i], problem.AllowedInputVariables.Contains(i));
+        targetsListBox.Items.Add(problem.DataSet.GetVariableName(i), problem.AllowedTargetVariables.Contains(i));
+        inputsListBox.Items.Add(problem.DataSet.GetVariableName(i), problem.AllowedInputVariables.Contains(i));
       }
     }
@@ -94,5 +94,7 @@
           dataset.Rows = parser.Rows;
           dataset.Columns = parser.Columns;
-          dataset.VariableNames = parser.VariableNames;
+          for (int i = 0; i < parser.VariableNames.Length; i++) {
+            dataset.SetVariableName(i, parser.VariableNames[i]);
+          }
           dataset.Name = parser.ProblemName;
           dataset.Samples = new double[dataset.Rows * dataset.Columns];
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/Dataset.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/Dataset.cs	(revision 1214)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/Dataset.cs	(revision 1215)
@@ -52,5 +52,10 @@
     public int Columns {
       get { return columns; }
-      set { columns = value; }
+      set { 
+        columns = value;
+        if (variableNames == null || variableNames.Length != columns) {
+          variableNames = new string[columns];
+        }
+      }
     }
 
@@ -90,12 +95,8 @@
 
     private string[] variableNames;
-    public string[] VariableNames {
-      get { return variableNames; }
-      set { variableNames = value; }
-    }
 
     public Dataset() {
       Name = "-";
-      VariableNames = new string[] { "Var0" };
+      variableNames = new string[] { "Var0" };
       Columns = 1;
       Rows = 1;
@@ -114,4 +115,13 @@
       }
     }
+
+    public string GetVariableName(int variableIndex) {
+      return variableNames[variableIndex];
+    }
+
+    public void SetVariableName(int variableIndex, string name) {
+      variableNames[variableIndex] = name;
+    }
+
 
     public override IView CreateView() {
@@ -128,6 +138,6 @@
       clone.Samples = cloneSamples;
       clone.Name = Name;
-      clone.VariableNames = new string[VariableNames.Length];
-      Array.Copy(VariableNames, clone.VariableNames, VariableNames.Length);
+      clone.variableNames = new string[variableNames.Length];
+      Array.Copy(variableNames, clone.variableNames, variableNames.Length);
       Array.Copy(scalingFactor, clone.scalingFactor, columns);
       Array.Copy(scalingOffset, clone.scalingOffset, columns);
@@ -165,5 +175,5 @@
       columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
 
-      VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
+      variableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
       if(node.Attributes["ScalingFactors"] != null)
         scalingFactor = ParseDoubleString(node.Attributes["ScalingFactors"].Value);
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/DatasetView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/DatasetView.cs	(revision 1214)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.DataAnalysis/DatasetView.cs	(revision 1215)
@@ -135,6 +135,6 @@
 
     private string GetColumnName(int index) {
-      if(Dataset.VariableNames.Length == dataGridView.Columns.Count) {
-        return Dataset.VariableNames[index];
+      if(Dataset.Columns == dataGridView.Columns.Count) {
+        return Dataset.GetVariableName(index);
       } else {
         return "Var " + index;
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StructIdProblemInjectorView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StructIdProblemInjectorView.cs	(revision 1214)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StructIdProblemInjectorView.cs	(revision 1215)
@@ -63,5 +63,5 @@
     protected override void UpdateControls() {
       base.UpdateControls();
-      if(StructIdProblemInjector == null) {
+      if (StructIdProblemInjector == null) {
         importInstanceButton.Enabled = false;
       } else {
@@ -73,5 +73,5 @@
 
     private void importInstanceButton_Click(object sender, EventArgs e) {
-      if(openFileDialog.ShowDialog(this) == DialogResult.OK) {
+      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
         DatasetParser parser = new DatasetParser();
         bool success = false;
@@ -80,5 +80,6 @@
             parser.Import(openFileDialog.FileName, true);
             success = true;
-          } catch(DataFormatException ex) {
+          }
+          catch (DataFormatException ex) {
             ShowWarningMessageBox(ex);
             // not possible to parse strictly => clear and try to parse non-strict
@@ -87,13 +88,16 @@
             success = true;
           }
-        } catch(DataFormatException ex) {
+        }
+        catch (DataFormatException ex) {
           // if the non-strict parsing also failed then show the exception
           ShowErrorMessageBox(ex);
         }
-        if(success) {
+        if (success) {
           Dataset dataset = (Dataset)StructIdProblemInjector.GetVariable("Dataset").Value;
           dataset.Rows = parser.Rows;
           dataset.Columns = parser.Columns;
-          dataset.VariableNames = parser.VariableNames;
+          for (int i = 0; i < parser.VariableNames.Length; i++) {
+            dataset.SetVariableName(i, parser.VariableNames[i]);
+          }
           dataset.Name = parser.ProblemName;
           dataset.Samples = new double[dataset.Rows * dataset.Columns];
@@ -109,10 +113,10 @@
 
           IVariable var = StructIdProblemInjector.GetVariable("AllowedFeatures");
-          if(var != null) {
+          if (var != null) {
             ItemList<IntData> allowedFeatures = (ItemList<IntData>)var.Value;
             allowedFeatures.Clear();
             List<int> nonInputVariables = parser.NonInputVariables;
-            for(int i = 0; i < dataset.Columns; i++) {
-              if(!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i));
+            for (int i = 0; i < dataset.Columns; i++) {
+              if (!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i));
             }
           }
@@ -124,5 +128,5 @@
     private void TrySetVariable(string name, int value) {
       IVariable var = StructIdProblemInjector.GetVariable(name);
-      if(var != null) {
+      if (var != null) {
         ((IntData)var.Value).Data = value;
       }
@@ -145,5 +149,5 @@
       sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace);
 
-      while(ex.InnerException != null) {
+      while (ex.InnerException != null) {
         ex = ex.InnerException;
         sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace);
