Index: fittingview/src/sans/perspectives/fitting/basepage.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/basepage.py	(revision 8e671c399897e6c96e0270b9fa911c5c77290054)
+++ fittingview/src/sans/perspectives/fitting/basepage.py	(revision 5e48acb9f6415c9846b820553b19927d5c703b33)
@@ -75,4 +75,5 @@
         self.mask = None
         self.uid = wx.NewId()
+        self.graph_id = None
         #Q range for data set
         self.qmin_data_set = None
Index: fittingview/src/sans/perspectives/fitting/fitpage.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitpage.py	(revision 6721b756a5f7be378b7276ae004d4f7014e88f04)
+++ fittingview/src/sans/perspectives/fitting/fitpage.py	(revision 5e48acb9f6415c9846b820553b19927d5c703b33)
@@ -1804,18 +1804,22 @@
         reset the current data 
         """
+        from sans.guiframe.dataFitting import check_data_validity
         id = None
-        group_id = None
         flag = False
+        is_data = False
         if self.data is not None:
-            group_id = self.data.group_id
-           
-        if self.data is None and data is not None:
+            is_data = check_data_validity(self.data)  
+        if not is_data and data is not None:
                 flag = True
         if data is not None:
             id = data.id
-            if self.data is not None:
+            if is_data:
+                self.graph_id = self.data.group_id
                 flag = (data.id != self.data.id)
         self.data = data
-        self.data.group_id = group_id
+        if check_data_validity(data):
+            self.graph_id = data.group_id
+        self.data.group_id = self.graph_id
+        
         if self.data is None:
             data_min = ""
@@ -1905,4 +1909,6 @@
         self.state.qmax = self.qmax_x
         self.enable_fit_button()
+        # send graph_id to page_finder 
+        self._manager.set_graph_id(uid=self.uid, graph_id=self.graph_id)
         #update model plot with new data information
         if flag:
@@ -1918,5 +1924,5 @@
             #by removing the previous selected data
             wx.PostEvent(self._manager.parent, NewPlotEvent(action="remove",
-                                                    group_id=group_id, id=id))
+                                                    group_id=self.graph_id, id=id))
             #plot the current selected data
             wx.PostEvent(self._manager.parent, NewPlotEvent(plot=self.data, 
Index: fittingview/src/sans/perspectives/fitting/fitpanel.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitpanel.py	(revision 22ce7e2ae45e5d4760ea62cd98bf115aa211f119)
+++ fittingview/src/sans/perspectives/fitting/fitpanel.py	(revision 5e48acb9f6415c9846b820553b19927d5c703b33)
@@ -536,8 +536,11 @@
             self._manager.sim_page=None 
             return
+        """
+        # The below is not working when delete #5 and still have #6.
         if selected_page.__class__.__name__ == "FitPage":
             self.fit_page_index -= 1
         else:
             self.batch_page_index -= 1
+        """
         ## closing other pages
         state = selected_page.createMemento()
@@ -575,3 +578,2 @@
                 break 
       
-  
Index: fittingview/src/sans/perspectives/fitting/fitproblem.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitproblem.py	(revision 1b14795786d3947586fb520fd5306756edf3f391)
+++ fittingview/src/sans/perspectives/fitting/fitproblem.py	(revision 5e48acb9f6415c9846b820553b19927d5c703b33)
@@ -117,5 +117,12 @@
         Return the caption of the page associated with object
         """
-        
+    def set_graph_id(self, id):
+        """
+        Set graph id (from data_group_id at the time the graph produced) 
+        """
+    def get_graph_id(self): 
+        """
+        Get graph_id
+        """  
    
 class FitProblemDictionary(FitProblemComponent, dict):
@@ -136,4 +143,5 @@
         self.qmin = None
         self.qmax = None
+        self.graph_id = None
         self._smear_on = False
         self.scheduled = 0
@@ -399,5 +407,17 @@
         return self.result
     
-
+    def set_graph_id(self, id):
+        """
+        Set graph id (from data_group_id at the time the graph produced) 
+        """
+        self.graph_id = id
+        
+    def get_graph_id(self): 
+        """
+        Get graph_id
+        """  
+        return self.graph_id
+    
+    
 class FitProblem(FitProblemComponent):
     """  
@@ -617,4 +637,14 @@
         return self.fit_tab_caption
     
-  
+    def set_graph_id(self, id):
+        """
+        Set graph id (from data_group_id at the time the graph produced) 
+        """
+        self.graph_id = id
+        
+    def get_graph_id(self): 
+        """
+        Get graph_id
+        """  
+        return self.graph_id
    
Index: fittingview/src/sans/perspectives/fitting/fitting.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitting.py	(revision 22ce7e2ae45e5d4760ea62cd98bf115aa211f119)
+++ fittingview/src/sans/perspectives/fitting/fitting.py	(revision 5e48acb9f6415c9846b820553b19927d5c703b33)
@@ -321,5 +321,10 @@
                 selected_data_list = data_list
             try:
+                group_id = wx.NewId()
                 for data in selected_data_list:
+                    if data is not None:
+                        data.group_id = group_id
+                    if group_id not in data.list_group_id:
+                        data.list_group_id.append(group_id)
                     page = self.add_fit_page(data=[data])
             except:
@@ -334,5 +339,5 @@
             self.parent.on_close_welcome_panel()
 
-             
+        
     def set_theory(self,  theory_list=None):
         """
@@ -435,5 +440,17 @@
         """
         self.page_finder[uid].set_param2fit(param2fit)
-                  
+        
+    def set_graph_id(self, uid, graph_id):
+        """
+        Set graph_id for fitprobelm
+        """
+        self.page_finder[uid].set_graph_id(graph_id)
+        
+    def get_graph_id(self, uid):
+        """
+        Set graph_id for fitprobelm
+        """
+        return self.page_finder[uid].get_graph_id()    
+                          
     def save_fit_state(self, filepath, fitstate):  
         """
@@ -978,4 +995,10 @@
         self.panel = event.GetEventObject()
         Plugin.on_perspective(self, event=event)
+        self.select_data(self.panel)
+        
+    def select_data(self, panel):
+        """
+        """
+        self.panel = panel
         for plottable in self.panel.graph.plottables:
             if plottable.__class__.__name__ in ["Data1D", "Theory1D"]:
@@ -1319,5 +1342,8 @@
             _xaxis, _xunit = data.get_xaxis() 
             new_plot.title = data.name
-            new_plot.group_id = data.group_id
+
+            new_plot.group_id = self.page_finder[page_id].get_graph_id()
+            if new_plot.group_id == None:
+                new_plot.group_id = data.group_id
             new_plot.id =  str(page_id) + "model"
             if new_plot.id in self.color_dict:
@@ -1631,5 +1657,8 @@
         new_plot.id = "res" + str(data_copy.id)#name + " residuals"
         ##group_id specify on which panel to plot this data
-        new_plot.group_id = new_plot.id
+        group_id = self.page_finder[page_id].get_graph_id()
+        if group_id == None:
+            group_id = data.group_id
+        new_plot.group_id ="res" + str(group_id)
         #new_plot.is_data = True
         ##post data to plot
