Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision e3d1423c71ae5d7253d329d43719f084db6dc35c)
+++ sansview/perspectives/fitting/basepage.py	(revision 3c44c66f5a43cf590e90b9a7ba318e6e6f869f58)
@@ -44,4 +44,5 @@
         #Set window's font size 
         self.SetWindowVariant(variant=FONT_VARIANT)
+       
         ## parent of the page
         self.parent = parent
@@ -160,5 +161,5 @@
         ## layout
         self.set_layout()
-       
+        
     class ModelTextCtrl(wx.TextCtrl):
         """
@@ -233,6 +234,7 @@
         def _silent_kill_focus(self,event):
             """
-            do nothing to kill focus
+            Save the state of the page
             """
+            
             event.Skip()
             pass
@@ -803,6 +805,7 @@
         self._copy_parameters_state(self.fittable_param, self.state.fittable_param)
         self._copy_parameters_state(self.fixed_param, self.state.fixed_param)
-    
-
+        #save chisqr
+        self.state.tcChi = self.tcChi.GetValue()
+        
     def save_current_state_fit(self):
         """
@@ -1008,6 +1011,9 @@
         ## draw the model with previous parameters value
         self._onparamEnter_helper()
+        #reset the value of chisqr when not consistent with the value computed
+        self.tcChi.SetValue(str(self.state.tcChi))
         ## reset context menu items
         self._reset_context_menu()
+        
         ## set the value of the current state to the state given as parameter
         self.state = state.clone() 
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision 0b12abb5c0c3b5a6afac1385baf8c31c36e66602)
+++ sansview/perspectives/fitting/fitpage.py	(revision 3c44c66f5a43cf590e90b9a7ba318e6e6f869f58)
@@ -1936,5 +1936,5 @@
             self.tcChi.SetValue(str(format_number(output)))
 
-            self.state.tcChi =self.tcChi
+            self.state.tcChi = self.tcChi.GetValue()
         except:
             pass  
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 0b12abb5c0c3b5a6afac1385baf8c31c36e66602)
+++ sansview/perspectives/fitting/fitpanel.py	(revision 3c44c66f5a43cf590e90b9a7ba318e6e6f869f58)
@@ -200,4 +200,17 @@
         self.Center()
         
+    def set_data(self, list=[]):
+        """
+        Receive a list of data and create new 
+        """
+        if list==[]:
+            msg = "Please select data for Fitting perspective.\n"
+            dial = wx.MessageDialog(None, msg, 'Error Loading File', 
+                                    wx.OK | wx.ICON_EXCLAMATION)
+            dial.ShowModal() 
+            return 
+        for data, path in list:
+            self.manager.add_fit_page(data=data)
+            
     def set_state(self, state):
         """
@@ -415,11 +428,10 @@
                 return panel 
             else:
-                for name, panel in self.opened_pages.values():
-                    #Don't return any panel is the exact same page is created
-                    if name == page_info.window_name:
+                for value in self.opened_pages.values():
+                    if page_info.window_name == str(value[0]):
+                        #Don't return any panel is the exact same page is created
                         return None
-                    else:
-                        panel = self.add_page(page_info=page_info)
-                        return panel        
+                panel = self.add_page(page_info=page_info)
+                return panel        
         else:
             #a new type of page is created
Index: sansview/perspectives/fitting/pagestate.py
===================================================================
--- sansview/perspectives/fitting/pagestate.py	(revision 3ad91de3cdb8151baa3407b629cbda25cf9068b2)
+++ sansview/perspectives/fitting/pagestate.py	(revision 3c44c66f5a43cf590e90b9a7ba318e6e6f869f58)
@@ -362,11 +362,11 @@
         rep += "model  : %s\n\n"% str(self.model)
         rep += "number parameters(self.parameters): %s\n"%len(self.parameters)
-        rep += self._repr_helper( list=self.parameters, rep=rep)
+        rep = self._repr_helper( list=self.parameters, rep=rep)
         rep += "number orientation parameters"
         rep += "(self.orientation_params): %s\n"%len(self.orientation_params)
-        rep += self._repr_helper( list=self.orientation_params, rep=rep)
+        rep = self._repr_helper( list=self.orientation_params, rep=rep)
         rep += "number dispersity parameters"
         rep += "(self.orientation_params_disp): %s\n"%len(self.orientation_params_disp)
-        rep += self._repr_helper( list=self.orientation_params_disp, rep=rep)
+        rep = self._repr_helper( list=self.orientation_params_disp, rep=rep)
         
         return rep
@@ -1138,5 +1138,5 @@
                 output[0].filename = state.file
                 state.data = output[0]
-                state.data.name = state.data_name
+                state.data.name = output[0].filename #state.data_name
                 state.data.id = state.data_id
                 state.data.id = state.data_id
@@ -1182,11 +1182,43 @@
             fitstate.toXML(file=filename)
         
-"""     
-Example: ::
+
   
-    if __name__ == "__main__":
-        state = PageState(parent=None)
-        state.toXML()
-        print "state", state
+if __name__ == "__main__":
+    state = PageState(parent=None)
+    #state.toXML()
+    """
     
-"""
+    file = open("test_state", "w")
+    pickle.dump(state, file)
+    print pickle.dumps(state)
+    state.data_name = "hello---->"
+    pickle.dump(state, file)
+    file = open("test_state", "r")
+    new_state= pickle.load(file)
+    print "new state", new_state
+    new_state= pickle.load(file)
+    print "new state", new_state
+    #print "state", state
+    """
+    import bsddb
+    import pickle
+    db= bsddb.btopen('file_state.db', 'c')
+    val = (pickle.dumps(state), "hello", "hi")
+    db['state1']= pickle.dumps(val)
+    print pickle.loads(db['state1'])
+    state.data_name = "hello---->22"
+    db['state2']= pickle.dumps(state)
+    state.data_name = "hello---->2"
+    db['state3']= pickle.dumps(state)
+    del db['state3']
+    state.data_name = "hello---->3"
+    db['state4']= pickle.dumps(state)
+    new_state = pickle.loads(db['state1'])
+    #print db.last()
+    db.set_location('state2')
+    state.data_name = "hello---->5"
+    db['aastate5']= pickle.dumps(state)
+    db.keys().sort()
+    print pickle.loads(db['state2'])
+  
+    db.close()
