diff --git a/matlab/parallel/closeSlave.m b/matlab/parallel/closeSlave.m
index 40e70c4cbbd2143c79b10d3eb1a3dd9dd5bb6bf7..5d3f443fdf3b18a8849c1f0c0fba15f85e93cded 100644
--- a/matlab/parallel/closeSlave.m
+++ b/matlab/parallel/closeSlave.m
@@ -6,7 +6,7 @@ function closeSlave(Parallel,TmpFolder,partial)
 %
 % INPUTS
 %  o Parallel [struct vector]   copy of options_.parallel.
-%  o TmpFolder        string    if islocal==0, is the name of didectory devoted to remote computation.
+%  o TmpFolder        string    if islocal==0, is the name of directory devoted to remote computation.
 %                               This directory is named using current date
 %                               and is used only one time and then deleted.
 %                               If islocal==1, TmpFolder=''.
@@ -45,32 +45,19 @@ if partial==1
             dynareParallelSendFiles('slaveParallel_break.mat',TmpFolder,Parallel(indPC));
         end
     end
-    %     delete('slaveParallel_break')
-    return
-end
-if partial==-1
-    delete('slaveParallel_break.mat')
-    for indPC=1:length(Parallel)
-        if (Parallel(indPC).Local==0)
-            dynareParallelDelete( 'slaveParallel_break.mat',TmpFolder,Parallel(indPC));
-        end
-    end
-    %     delete('slaveParallel_break')
+    s=warning('on');
     return
 end
 
 for indPC=1:length(Parallel)
     if (Parallel(indPC).Local==0)
-        dynareParallelDelete( 'slaveParallel_input*.mat',TmpFolder,Parallel(indPC));
+        dynareParallelDelete(' slaveParallel_input*.mat',TmpFolder,Parallel(indPC));
     end
-
-
     delete( 'slaveParallel_input*.mat');
     delete( 'slaveJob*.mat');
     pause(1)
     delete('slaveParallel_*.log');
     delete ConcurrentCommand1.bat;
-
 end
 
 while(1)
diff --git a/matlab/parallel/slaveParallel.m b/matlab/parallel/slaveParallel.m
index 48f1a7a3f6d6b99cacc0abaec5cc46b3074cd85d..1d094e6f0408360c6b8ccf928fd1c17d5a8d00fa 100644
--- a/matlab/parallel/slaveParallel.m
+++ b/matlab/parallel/slaveParallel.m
@@ -48,7 +48,7 @@ dynareroot = dynare_config();
 load( ['slaveParallel_input',int2str(whoiam)]);
 
 %Loads fGlobalVar Parallel.
-if exist('fGlobalVar')
+if exist('fGlobalVar','var')
     globalVars = fieldnames(fGlobalVar);
     for j=1:length(globalVars)
         eval(['global ',globalVars{j},';']);
@@ -70,7 +70,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
         t0=clock;
         delete(['stayalive',int2str(whoiam),'.txt']);
     end
-    % I wait for 20 min or while mater asks to exit (i.e. it cancels fslave file)
+    % I wait for 20 min or while master asks to exit (i.e. it cancels fslave file)
     pause(1)
 
     fjob = dir(['slaveJob',int2str(whoiam),'.mat']);
@@ -79,8 +79,6 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
         clear fGlobalVar fInputVar fblck nblck fname
 
         while(1)
-            Go=0;
-
             Go=fopen(['slaveJob',int2str(whoiam),'.mat']);
 
             if Go>0
@@ -104,7 +102,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
 
         funcName=fname;  % Update global job name.
 
-        if exist('fGlobalVar') && ~isempty (fGlobalVar)
+        if exist('fGlobalVar','var') && ~isempty (fGlobalVar)
             globalVars = fieldnames(fGlobalVar);
             for j=1:length(globalVars)
                 info_whos = whos(globalVars{j});
@@ -126,11 +124,6 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
             tic
             fOutputVar = feval(fname, fInputVar ,fblck, nblck, whoiam, ThisMatlab);
             toc
-            if isfield(fOutputVar,'OutputFileName')
-                OutputFileName = fOutputVar.OutputFileName;
-            else
-                OutputFileName = '';
-            end
 
             if(whoiam)
 
@@ -183,5 +176,4 @@ diary off;
 
 delete(['P_slave_',int2str(whoiam),'End.txt']);
 
-
 exit;