diff --git a/matlab/+occbin/DSGE_smoother.m b/matlab/+occbin/DSGE_smoother.m
index 364b328862aaf3b86735f10fcbe5c26117419457..4e33ffa4121741998ffd671f5b41e8dbe5c25907 100644
--- a/matlab/+occbin/DSGE_smoother.m
+++ b/matlab/+occbin/DSGE_smoother.m
@@ -300,13 +300,13 @@ while is_changed && maxiter>iter && ~is_periodic
             eee(:,k) = eig(TT(:,:,k));
         end
         if options_.debug
-        err_eig(iter-1) = max(max(abs(sort(eee)-sort(sto_eee))));
-        err_alphahat(iter-1) = max(max(max(abs(alphahat-sto_alphahat))));
-        err_etahat(iter-1) = max(max(max(abs(etahat-sto_etahat{iter-1}))));
-        err_CC(iter-1) = max(max(max(abs(CC-sto_CC))));
-        err_RR(iter-1) = max(max(max(abs(RR-sto_RR))));
-        err_TT(iter-1) = max(max(max(abs(TT-sto_TT))));
-    end
+            err_eig(iter-1) = max(max(abs(sort(eee)-sort(sto_eee))));
+            err_alphahat(iter-1) = max(max(max(abs(alphahat-sto_alphahat))));
+            err_etahat(iter-1) = max(max(max(abs(etahat-sto_etahat{iter-1}))));
+            err_CC(iter-1) = max(max(max(abs(CC-sto_CC))));
+            err_RR(iter-1) = max(max(max(abs(RR-sto_RR))));
+            err_TT(iter-1) = max(max(max(abs(TT-sto_TT))));
+        end
     end
 
     if occbin_smoother_debug || is_periodic
@@ -484,9 +484,9 @@ if (~is_changed || occbin_smoother_debug) && nargin==12
                         fprintf(fidTeX,'\\label{Fig:smoothedshocks_occbin:%s}\n',int2str(ifig));
                         fprintf(fidTeX,'\\end{figure}\n');
                         fprintf(fidTeX,' \n');
+                    end
                 end
             end
-            end
         end
 
         if mod(j1,9)~=0 && j==M_.exo_nbr