Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 1b07935d9fc66943962a7fbfdb0f3368a1b27b9b)
+++ sansview/perspectives/fitting/fitpanel.py	(revision 060b857e0892ecb70b79b6029b040c9fb57e76c5)
@@ -50,5 +50,6 @@
         # save the title of the last page tab added
         self.fit_page_name=None
-        self.draw_model_name=[]
+        self.draw_model_name=None
+        self.page_name="Model View"
         self.nb.Update()
         self.SetSizer(self.sizer)
@@ -90,5 +91,7 @@
             return panel
     def add_model_page(self,model,page_title):
-        if not  page_title in self.draw_model_name: 
+        print "fitpanel: self.draw_model_name",self.draw_model_name
+        if  page_title !=self.draw_model_name or self.draw_model_name ==None: 
+            print "went here"
             from modelpage import ModelPage
             panel = ModelPage(self.nb,model, -1)
@@ -97,5 +100,13 @@
             self.nb.AddPage(page=panel,text=page_title,select=True)
             panel.populate_box( self.model_list_box)
-            self.draw_model_name.append(page_title)
+            self.draw_model_name=page_title
+        else:
+            print "fitpanel: a page was added already "
+            for i in range(self.nb.GetPageCount()):
+                if self.nb.GetPageText(i)==self.page_name:
+                    page=self.nb.GetPage(i)
+                    page.set_page(model)
+                    break
+                
            
   
@@ -147,7 +158,11 @@
                     del page_finder[page]
                     break
-            #delete the page from notebook
+            #Delete the page from notebook
+            page_number = self.nb.GetSelection()
+            if self.nb.GetPageText(page_number)== self.page_name:
+                self.draw_model_name=None
+                
             selected_page.Destroy()
-            self.nb.RemovePage(self.nb.GetSelection())
+            self.nb.RemovePage(page_number)
             self.name=None
             
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 1b07935d9fc66943962a7fbfdb0f3368a1b27b9b)
+++ sansview/perspectives/fitting/fitting.py	(revision 060b857e0892ecb70b79b6029b040c9fb57e76c5)
@@ -234,5 +234,6 @@
             self.plot_helper(currpage=current_pg,qmin=qmin,qmax=qmax)
         except:
-             wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+            raise
+            wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
             
        
@@ -352,6 +353,6 @@
                 #print "fitting: pars",pars
                 pars.sort()
-                
-                self.fitter.set_model(model,model.name, self.id, pars) 
+                print "fitting: model ",model.__class__.__name__
+                self.fitter.set_model(Model(model),model.name, self.id, pars) 
                 self.fitter.set_data(data,self.id,qmin,qmax)
                 #Do the fit SCIPY
@@ -543,4 +544,5 @@
             Plot a theory from a model selected from the menu
         """
+        print "_on_model_menu done"
         #name = evt.model.__class__.__name__
         name="Model View"
Index: sansview/perspectives/fitting/modelpage.py
===================================================================
--- sansview/perspectives/fitting/modelpage.py	(revision 1b07935d9fc66943962a7fbfdb0f3368a1b27b9b)
+++ sansview/perspectives/fitting/modelpage.py	(revision 060b857e0892ecb70b79b6029b040c9fb57e76c5)
@@ -49,22 +49,16 @@
         #panel interface
         self.vbox  = wx.BoxSizer(wx.VERTICAL)
-       
         self.sizer3 = wx.GridBagSizer(5,5)
         self.sizer2 = wx.GridBagSizer(5,5)
-       
         self.modelbox = wx.ComboBox(self, -1)
         id = wx.NewId()
-       
         self.vbox.Add(self.sizer3)
         self.vbox.Add(self.sizer2)
-      
         ix = 0
         iy = 1
-        
         self.sizer3.Add(wx.StaticText(self,-1,'Model'),(iy,ix),(1,1)\
                   , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
         self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-       
         # contains link between  model ,all its parameters, and panel organization
         self.parameters=[]
@@ -79,10 +73,8 @@
         # flag to check if the user has selected a new model in the combox box
         self.model_hasChanged=False
-       
         #dictionary of model name and model class
         self.model_list_box={}
         # Data1D to make a deep comparison between 2 Data1D for checking data
         #change
-       
         self.vbox.Layout()
         self.vbox.Fit(self) 
@@ -124,6 +116,15 @@
             wx.EVT_COMBOBOX(self.modelbox,-1, self._on_select_model) 
         return 0
-    
-    
+   
+    def set_page(self, model):
+        print " modelpage: set_page was called",model
+        self.model=model
+        if hasattr(self.model, "name"):
+            name = self.model.name
+        else:
+            name = self.model.__class__.__name__
+        self.modelbox.SetValue(name)
+        self.set_panel(self.model)
+        self.manager.draw_model(self.model)
     def _on_select_model(self,event):
         """
@@ -191,4 +192,5 @@
         iy = 1
         ix = 0
+        
         self.cb1 = wx.StaticText(self, -1,'Parameters')
         self.sizer2.Add(self.cb1,(iy, ix),(1,1),\
@@ -246,7 +248,7 @@
             for item in self.parameters:
                 try:
-                     name=str(item[0])
+                     name=str(item[0].GetLabelText())
                      value= float(item[1].GetValue())
-                     
+                     print "modelpage: name. value",name , value
                      self.model.setParam(name,value)
                      self.manager.draw_model(self.model)
Index: sansview/perspectives/fitting/models.py
===================================================================
--- sansview/perspectives/fitting/models.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/models.py	(revision 060b857e0892ecb70b79b6029b040c9fb57e76c5)
@@ -4,4 +4,5 @@
 
 (ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent()
+
 
 
