Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 4f813427ffc479ac0a4cba49e2aa7b75fd410820)
+++ sansview/perspectives/fitting/fitting.py	(revision b35d3d1fd21996b7e3eed67f36661a33aeccb11d)
@@ -257,4 +257,5 @@
         loader = Loader()
         loader.associate_file_reader(".fitv", self.state_reader)
+        loader.associate_file_reader(".svs", self.state_reader)
         #Send the fitting panel to guiframe
         self.mypanels.append(self.fit_panel)
Index: sansview/perspectives/fitting/pagestate.py
===================================================================
--- sansview/perspectives/fitting/pagestate.py	(revision 3c44c66f5a43cf590e90b9a7ba318e6e6f869f58)
+++ sansview/perspectives/fitting/pagestate.py	(revision b35d3d1fd21996b7e3eed67f36661a33aeccb11d)
@@ -603,7 +603,8 @@
     
     ## Wildcards
-    type = ["Fitting files (*.fitv)|*.fitv"]
+    type = ["Fitting files (*.fitv)|*.fitv"
+            "SANSView file (*.svs)|*.svs"]
     ## List of allowed extensions
-    ext=['.fitv', '.FITV']  
+    ext=['.fitv', '.FITV', '.svs', 'SVS']   
     
     def __init__(self, call_back=None, cansas=True):
@@ -834,9 +835,12 @@
         """
         # Create an empty state
-        state = PageState()
+        state = None   
         # Locate the P(r) node
         try:
             nodes = entry.xpath('ns:%s' % FITTING_NODE_NAME, namespaces={'ns': CANSAS_NS})
-            state.fromXML(node=nodes[0])
+            if nodes !=[]:
+                # Create an empty state
+                state =  PageState()
+                state.fromXML(node=nodes[0])
         except:
             logging.info("XML document does not contain fitting information.\n %s" % sys.exc_value)
@@ -1106,5 +1110,5 @@
                     root = tree.getroot()
                     entry_list = root.xpath('ns:SASentry', namespaces={'ns': CANSAS_NS})
-                    for entry in entry_list:
+                    for entry in entry_list:   
                         try:
                             sas_entry = self._parse_entry(entry)
@@ -1112,41 +1116,48 @@
                             raise
                         fitstate = self._parse_state(entry)
-                        sas_entry.meta_data['fitstate'] = fitstate
-                        sas_entry.filename = fitstate.file
-                        output.append(sas_entry)
+                        
+                        #state could be None when .svs file is loaded
+                        #in this case, skip appending to output
+                        if fitstate != None:
+                            sas_entry.meta_data['fitstate'] = fitstate
+                            sas_entry.filename = fitstate.file
+                            output.append(sas_entry)
             else:
                 raise RuntimeError, "%s is not a file" % path
-            
+
             # Return output consistent with the loader's api
             if len(output)==0:
                 return None
-            elif len(output)==1:
-                # Call back to post the new state
-                state = output[0].meta_data['fitstate']
-                t = time.localtime(state.timestamp)
-                time_str = time.strftime("%b %d %H:%M", t)
-                # Check that no time stamp is already appended
-                max_char = state.file.find("[")
-                if max_char < 0:
-                    max_char = len(state.file)
-                state.file = state.file[0:max_char] +' [' + time_str + ']'
-               
-                    
-                if state is not None and state.is_data is not None:
-                    exec 'output[0].is_data = state.is_data' 
-                 
-                output[0].filename = state.file
-                state.data = output[0]
-                state.data.name = output[0].filename #state.data_name
-                state.data.id = state.data_id
-                state.data.id = state.data_id
-                if state.is_data is not None:
-                    state.data.is_data = state.is_data
-                state.data.group_id = output[0].filename
+            else:
+                for ind in range(len(output)):
+                    # Call back to post the new state
+                    state = output[ind].meta_data['fitstate']
+                    t = time.localtime(state.timestamp)
+                    time_str = time.strftime("%b %d %H:%M", t)
+                    # Check that no time stamp is already appended
+                    max_char = state.file.find("[")
+                    if max_char < 0:
+                        max_char = len(state.file)
+                    state.file = state.file[0:max_char] +' [' + time_str + ']'
+                   
+                        
+                    if state is not None and state.is_data is not None:
+                        exec 'output[%d].is_data = state.is_data'% ind 
+                     
+                    output[ind].filename = state.file
+                    state.data = output[ind]
+                    state.data.name = output[ind].filename #state.data_name
+                    state.data.id = state.data_id
+                    state.data.id = state.data_id
+                    if state.is_data is not None:
+                        state.data.is_data = state.is_data
+                    state.data.group_id = output[ind].filename
+                  
+                    # make sure to put run name if none
+                    #if output[ind].run == None or output[ind].run ==[]:
+                    #    exec 'output[%d].run = [output[%d].filename]'% (ind,ind)
+                    self.call_back(state=state, datainfo=output[ind])
+                    return output[ind]
               
-                self.call_back(state=state, datainfo=output[0])
-                return output[0]
-            else:
-                return output                
         except:
             raise
@@ -1154,5 +1165,5 @@
     def write(self, filename, datainfo=None, fitstate=None):
         """
-        Write the content of a Data1D as a CanSAS XML file
+        Write the content of a Data1D as a CanSAS XML file only for standalone
         
         :param filename: name of the file to write
@@ -1165,14 +1176,5 @@
             
             # Add fitting information to the XML document
-            if fitstate is not None:
-                if fitstate.data is None:
-                    data = DataLoader.data_info.Data1D(x=[], y=[])   
-                elif issubclass(fitstate.data.__class__, DataLoader.data_info.Data1D):
-                    data = fitstate.data
-                    doc, sasentry = self._to_xml_doc(data)
-                else:
-                    data = fitstate.data
-                    doc, sasentry = self._data2d_to_xml_doc(data)
-                fitstate.toXML(doc=doc, file=data.name, entry_node=sasentry)
+            self.write_toXML(datainfo, fitstate)
             # Write the XML document
             fd = open(filename, 'w')
@@ -1182,5 +1184,32 @@
             fitstate.toXML(file=filename)
         
-
+    def write_toXML(self, datainfo=None, state=None):
+        """
+        Write toXML, a helper for write() , could be used by guimanager._on_save()
+        
+        : return: xml doc
+        """
+
+        if state.data is None:
+            data = DataLoader.data_info.Data1D(x=[], y=[])  
+        else:  
+            #make sure title and data run is filled up.
+            #if state.data.title == None or state.data.title=='': state.data.title = state.data.name
+            #if state.data.run_name == None or state.data.run_name=={}: 
+            #    state.data.run = [str(state.data.name)]
+            #    state.data.run_name[0] = state.data.name
+   
+            if issubclass(state.data.__class__, DataLoader.data_info.Data1D):
+                data = state.data
+                doc, sasentry = self._to_xml_doc(data)
+            else:
+                data = state.data
+                doc, sasentry = self._data2d_to_xml_doc(data)
+            
+
+        if state is not None:
+            state.toXML(doc=doc, file=data.name, entry_node=sasentry)
+            
+        return doc 
   
 if __name__ == "__main__":
