diff --git a/tsg_util/quitProgram.m b/tsg_util/quitProgram.m
index cc754a8b64d6b73610fa7db0335e7143cfe8957f..b74d33df28afa6866012879751eb881d65ec5f25 100644
--- a/tsg_util/quitProgram.m
+++ b/tsg_util/quitProgram.m
@@ -13,8 +13,8 @@ function quitProgram(hMainFig, hMapPanel, DEFAULT_PATH_FILE)
 
 % close the main windows
 % ----------------------
-delete(hMainFig);
 delete(hMapPanel);
+delete(hMainFig);
 
 % reset userdata property of root Matalab object (0) for next use
 % ---------------------------------------------------------------
diff --git a/tsgqc.m b/tsgqc.m
index 60122ee9cac6e4b718940c16a72e8fd34f0171ab..090ab2d7ff36898a54c11d4d27755db0d20e8236 100644
--- a/tsgqc.m
+++ b/tsgqc.m
@@ -629,7 +629,7 @@ hPlotAxes(3) = axes('Parent', hPlotsPanel, 'Visible', 'off',...
 % ---------------------------------
 hMapPanel = figure(...
    'BackingStore','off',...
-  'Name', 'TSG MAP FIGURE', ...
+  'Name', 'TSG SHIP TRACK', ...
   'NumberTitle', 'off', ...
   'Resize', 'on', ...
   'Menubar','none', ...
@@ -1905,8 +1905,10 @@ end
     
     % Re-draw the map once the zoom/pan is off 
     % ----------------------------------------
-    erase_Line( hPlotAxes, 4 );
-    plot_map( hMainFig, hPlotAxes);
+    if strcmp( get(hMapPanel,'visible'), 'on') == 1
+      erase_Line( hPlotAxes, 4 );
+      plot_map( hMainFig, hPlotAxes);
+    end
 
   end
 
@@ -2220,6 +2222,7 @@ end
   % Callback function ... to be completed
   % ---------------------------------------------------------------
   function postQcPanCallback(obj, evd)
+         
     % Set the right limit and interval to the 3 axes
     % ----------------------------------------------
     for iaxe = 1:3
@@ -2229,9 +2232,15 @@ end
 
     % Re-draw the map once the pan is off -  only valide in QC mode
     % -------------------------------------------------------------
-    erase_Line( hPlotAxes, 4 );
-    plot_map( hMainFig, hPlotAxes);
+    if strcmp( get(hMapPanel, 'visible'), 'on') == 1
+      erase_Line( hPlotAxes, 4 );
+      plot_map( hMainFig, hPlotAxes);
+    end
 
+    % restacks the figure to the top of the screen
+    % --------------------------------------------
+    figure( hMainFig);
+    
     set(hQCToggletool, 'state', 'on' );
 
   end
@@ -2282,7 +2291,7 @@ end
           set(hPan,'ActionPostCallback', @postQcPanCallback);
           set(hPan,'Enable','on');
         else
-          pan off
+            pan(hMainFig, 'off');
         end
       end
       
@@ -3179,7 +3188,7 @@ end
     % Make the earth map invisible
     % ----------------------------
     set(hMapPanel, 'Visible', 'off' ); 
-    set( hMapToggletool,       'state',  'off' );
+    set(hMapToggletool, 'state',  'off' );
     
   end