diff --git a/tsg_util/quitProgram.m b/tsg_util/quitProgram.m
new file mode 100644
index 0000000000000000000000000000000000000000..8ac15c130aa28e5940f58d1ee19ce32d320581cc
--- /dev/null
+++ b/tsg_util/quitProgram.m
@@ -0,0 +1,32 @@
+function quitProgram(hMainFig, DEFAULT_PATH_FILE)
+% QUITPROGRAM Exit tsgqc_GUI application
+%
+% Input
+% -----
+% hTsgGUI ............ Handel to the main user interface
+%
+% Output
+% ------
+% none
+
+% $Id$
+
+% close the main windows
+% ----------------------
+delete(hMainFig);
+
+% reset userdata property of root Matalab object (0) for next use
+% ---------------------------------------------------------------
+set(0, 'userdata', []);
+
+% reset Matlab search path to default
+% -----------------------------------
+rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
+rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
+rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );
+
+% Refresh file system caches
+% --------------------------
+rehash;
+
+end
\ No newline at end of file
diff --git a/tsg_util/tsg_preferences.m b/tsg_util/tsg_preferences.m
index 193570e109f31876f7806f1f5aebae0ea7a93740..f7931a8dfb257a804df8b6c5034d420168817b23 100644
--- a/tsg_util/tsg_preferences.m
+++ b/tsg_util/tsg_preferences.m
@@ -1,4 +1,4 @@
-function tsg_preferences(hTsgGUI, app_name)
+function tsg_preferences(hTsgGUI, app_name, DEFAULT_PATH_FILE)
 % tsg_preferences(S1,S2) returns structure tsg saved in S1.mat file
 % and with S2 internal version number.
 % If S1.mat dosn't exist, call tsg_initialisation to create it in
@@ -28,8 +28,8 @@ config_file = [prefdir, filesep, app_name, '.mat'];
 
 % Open config file
 % ----------------
-%config = fopen( config_file, 'r' );
-config = -1;
+config = fopen( config_file, 'r' );
+%config = -1;
 
 % test fopen return value
 % -----------------------
@@ -45,19 +45,29 @@ if config == -1
 
 else
   
-  % file exist, load in workspace
-  % -----------------------------
   try    
+    
+    % if file exist, load in workspace
+    % -----------------------------
     load( config_file, 'root', 'tsg' );
+  
+  catch
+    warning('tsgqc_GUI:tsg_preferences', ...
+      'Can''t load preference file ''%s''', config_file);  
+    quitProgram(hTsgGUI, DEFAULT_PATH_FILE);
+  end  
     
+  try  
     % set current preference autoload in submenu option/preference
     % ------------------------------------------------------------
     set(findobj('tag', 'TAG_UIMENU_OPTION_PREFERENCES', ...
                 'checked', root.preference.autoload));
     
   catch
-    warning('tsgqc_GUI:tsg_preferences', ['Can''t load : '  config_file]);
-    %datagui_closereq_callback;
+    warning('tsgqc_GUI:tsg_preferences', ...
+      ['Preference file ''%s''\nis malformed\n' ...
+       'delete it.'], config_file);
+     quitProgram(hTsgGUI, DEFAULT_PATH_FILE);
   end
 
   % If there no field version or wrong version, initialize
diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m
index f71ff6ba3b4d62d08f8380cb1f21012c0350ec8a..844afe6f9da18d01f40bdc750d2d56a8d3831da1 100644
--- a/tsgqc_GUI.m
+++ b/tsgqc_GUI.m
@@ -37,7 +37,7 @@ clc;
 % -------------------------------------
 global VERSION
 
-VERSION = '0.2a';
+VERSION = '0.2b';
 
 % reset userdata property of root Matlab object if it is not empty
 % ----------------------------------------------------------------
@@ -107,7 +107,7 @@ hMainFig = figure(...
 
 %% Initialize tsg structure with tsg_preference function
 % -----------------------------------------------------
-tsg_preferences(hMainFig, tsgqcname);
+tsg_preferences(hMainFig, tsgqcname, DEFAULT_PATH_FILE);
 
 % get root struct from root object
 % --------------------------------
@@ -2228,7 +2228,7 @@ end
       
       % quit program
       % ------------
-      QuitProgram;
+      quitProgram(hMainFig, DEFAULT_PATH_FILE);
       
     else
       selection = ...
@@ -2238,40 +2238,12 @@ end
       if strcmp(selection, 'No')
         return;
       else
-        QuitProgram;
+        quitProgram(hMainFig, DEFAULT_PATH_FILE);
       end
     end
 
   end
 
-%% QuitProgram
-  % -----------------------------------------------------------------
-  % call from: 
-  %   QuitMenuCallback
-  %   callback 'CloseRequestFcn', @QuitProgram
-  % -----------------------------------------------------------------
-  function QuitProgram(hObject, eventdata)
-    
-    % close the main windows
-    % ----------------------
-    delete(hMainFig);
-    
-    % reset userdata property of root Matalab object (0) for next use
-    % ---------------------------------------------------------------
-    set(0, 'userdata', []);
-
-    % reset Matlab search path to default
-    % -----------------------------------
-    rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
-    rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
-    rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );
-    
-    % Refresh file system caches
-    % --------------------------
-    rehash;
-    
-  end
-
 % end of tsgqc_GUI
 % ----------------
 end