diff --git a/matlab/estimation/GetAllPosteriorDraws.m b/matlab/estimation/GetAllPosteriorDraws.m
index fd6cdce1cdbf6b93c02d86fed1db3587e46692e2..9a4b67b3e44d31fb34931ce82c1ea4a5d84c9596 100644
--- a/matlab/estimation/GetAllPosteriorDraws.m
+++ b/matlab/estimation/GetAllPosteriorDraws.m
@@ -41,7 +41,11 @@ if ishssmc(options_)
     % Load draws from the posterior distribution
     pfiles = dir(sprintf('%s/hssmc/particles-*.mat', dname));
     posterior = load(sprintf('%s/hssmc/particles-%u-%u.mat', dname, length(pfiles), length(pfiles)));
-    draws = transpose(posterior.particles(column,:));
+    if column==0
+        draws = posterior.tlogpostkernel;
+    else
+        draws = transpose(posterior.particles(column,:));
+    end
 elseif isdime(options_)
     posterior = load(sprintf('%s%s%s%schains.mat', dname, filesep(), 'dime', filesep()));
     tune = posterior.tune;
diff --git a/matlab/estimation/draw_prior_density.m b/matlab/estimation/draw_prior_density.m
index 348231a225a468966aca05aacb7b47f749d7b1a0..f835a1a71d7a2e6c69048fe6adb541896d039ca4 100644
--- a/matlab/estimation/draw_prior_density.m
+++ b/matlab/estimation/draw_prior_density.m
@@ -86,10 +86,9 @@ end
 if pshape(indx) ~= 5
     [~,k1] = max(dens);
     if k1 == 1 || k1 == length(dens)
-        k = find(dens > 10);
-        dens(k) = NaN;
-        end
+        dens(dens > 10) = NaN;
     end
+end
 binf = abscissa(1);
 bsup = abscissa(end);
 x = abscissa;
diff --git a/matlab/estimation/generate_trace_plots.m b/matlab/estimation/generate_trace_plots.m
index b6e6c8b62f70c3495822dab56d2e9341f9e1a58a..8476ed36fec0e10eb157b9f1cf5201b99e74e2ec 100644
--- a/matlab/estimation/generate_trace_plots.m
+++ b/matlab/estimation/generate_trace_plots.m
@@ -30,15 +30,21 @@ function generate_trace_plots(chain_number)
 
 global M_ options_ estim_params_
 
-if issmc(options_)
-    error('generate_trace_plots:: SMC methods do not support trace plots')
-end
-
-% Get informations about the posterior draws:
-MetropolisFolder = CheckPath('metropolis', M_.dname);
-record=load_last_mh_history_file(MetropolisFolder, M_.fname);
-if max(chain_number)>record.Nblck
-    error('generate_trace_plots:: chain number is bigger than existing number of chains')
+if ~issmc(options_)
+    % Get informations about the posterior draws:
+    MetropolisFolder = CheckPath('metropolis', M_.dname);
+    record=load_last_mh_history_file(MetropolisFolder, M_.fname);
+    if max(chain_number)>record.Nblck
+        error('generate_trace_plots:: chain number is bigger than existing number of chains')
+    end
+else
+    if ishssmc(options_)
+       if max(chain_number)>1
+           error('generate_trace_plots:: HSSMC only has one chain')           
+       end
+    elseif isdime(options_)
+        error('generate_trace_plots:: DIME does not support generate_trace_plots')
+    end
 end
 
 trace_plot(options_, M_, estim_params_, 'PosteriorDensity', chain_number)
diff --git a/matlab/estimation/selec_posterior_draws.m b/matlab/estimation/selec_posterior_draws.m
index ad6c97c38b634e21d21744289653bc5d75e030e4..624c6e54f6e648553ec6d882860faba041cc983e 100644
--- a/matlab/estimation/selec_posterior_draws.m
+++ b/matlab/estimation/selec_posterior_draws.m
@@ -74,8 +74,6 @@ BaseName = [MetropolisFolder filesep ModelName];
 record=load_last_mh_history_file(MetropolisFolder, ModelName);
 FirstMhFile = record.KeepedDraws.FirstMhFile;
 FirstLine = record.KeepedDraws.FirstLine;
-TotalNumberOfMhFiles = sum(record.MhDraws(:,2));
-LastMhFile = TotalNumberOfMhFiles;
 TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
 NumberOfDraws = TotalNumberOfMhDraws-floor(options_.mh_drop*TotalNumberOfMhDraws);
 MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8);
diff --git a/matlab/estimation/smc/dime.m b/matlab/estimation/smc/dime.m
index bb2e5886e5f4bd639e979dba661b23fc14bf8a23..2dda3ac51bc8a1048be066a06823fb9ef9d5f802 100644
--- a/matlab/estimation/smc/dime.m
+++ b/matlab/estimation/smc/dime.m
@@ -85,7 +85,6 @@ function dime(TargetFun, init_x, mh_bounds, dataset_, dataset_info, options_, M_
     t0 = tic;
     [x, ~, lprob] = ...
         smc_samplers_initialization(funobj, 'dime', nchain, Prior, SimulationFolder, opts.niter);
-    tt = toc(t0);
     x = ptransform(x', bounds, true);
 
     disp_verbose(sprintf('Estimation:dime: log-posterior standard deviation (post.std) of a multivariate normal would be %.2f.\n', sqrt(0.5*ndim)), options_.verbosity);
@@ -164,7 +163,7 @@ function dime(TargetFun, init_x, mh_bounds, dataset_, dataset_info, options_, M_
 
         % be informative
         tt = toc(t0);
-        if iter == 1 | ~mod(iter,15)
+        if iter == 1 || ~mod(iter,15)
             disp_verbose('     #iter.      post.mode     post.std    %accept     lapsed', options_.verbosity)
             disp_verbose('     ------      ---------     --------    -------     ------', options_.verbosity)
         end
diff --git a/matlab/estimation/smc/trace_plot_dime.m b/matlab/estimation/smc/trace_plot_dime.m
index 02719db9903a88c8de026f82b799f881500e6698..4d984f1554e28e677ebe27ea20721532be480f85 100644
--- a/matlab/estimation/smc/trace_plot_dime.m
+++ b/matlab/estimation/smc/trace_plot_dime.m
@@ -43,7 +43,6 @@ else
 end
 
 graphFolder = CheckPath('graphs',M_.dname);
-latexFolder = CheckPath('latex',M_.dname);
 hh_fig = dyn_figure(options_.nodisplay,'Name','DIME Convergence Diagnostics');
 
 hold on
diff --git a/matlab/estimation/trace_plot.m b/matlab/estimation/trace_plot.m
index 9de1860b90d218cb2020d11ec36c897f067dd4d8..a3bb401abb322d9175fead4981e1f1d0065e47b7 100644
--- a/matlab/estimation/trace_plot.m
+++ b/matlab/estimation/trace_plot.m
@@ -52,22 +52,35 @@ if isempty(column)
     return
 end
 
-% Get informations about the posterior draws:
-MetropolisFolder = CheckPath('metropolis',M_.dname);
-record=load_last_mh_history_file(MetropolisFolder, M_.fname);
-
-FirstMhFile = 1;
-FirstLine = 1;
-TotalNumberOfMhFiles = sum(record.MhDraws(:,2));
-TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
-[mh_nblck] = size(record.LastParameters,2);
-clear record;
-
-n_nblocks_to_plot=length(blck);
+if ~issmc(options_)
+    % Get informations about the posterior draws:
+    MetropolisFolder = CheckPath('metropolis',M_.dname);
+    record=load_last_mh_history_file(MetropolisFolder, M_.fname);
+
+    FirstMhFile = 1;
+    FirstLine = 1;
+    TotalNumberOfMhFiles = sum(record.MhDraws(:,2));
+    TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
+    [mh_nblck] = size(record.LastParameters,2);
+    clear record;
+
+    n_nblocks_to_plot=length(blck);
+else
+    if ishssmc(options_)
+        n_nblocks_to_plot=1;
+    elseif isdime(options_)
+        error('trace_plot:: DIME does not support the trace_plot command')
+    end
+end
 
 if n_nblocks_to_plot==1
 % Get all the posterior draws:
-    PosteriorDraws = GetAllPosteriorDraws(options_, M_.dname,M_.fname,column, FirstMhFile, FirstLine, TotalNumberOfMhFiles, TotalNumberOfMhDraws, mh_nblck, blck);
+    if ishssmc(options_)
+        PosteriorDraws = GetAllPosteriorDraws(options_, M_.dname,[],column);
+        TotalNumberOfMhDraws=length(PosteriorDraws);
+    else
+        PosteriorDraws = GetAllPosteriorDraws(options_, M_.dname,M_.fname,column, FirstMhFile, FirstLine, TotalNumberOfMhFiles, TotalNumberOfMhDraws, mh_nblck, blck);
+    end
 else
     PosteriorDraws=NaN(TotalNumberOfMhDraws,n_nblocks_to_plot);
     save_string='';
diff --git a/tests/estimation/hssmc/fs2000.mod b/tests/estimation/hssmc/fs2000.mod
index 08a527b481768aa6cc3bdf6e201cc69da2d1b16e..4302ce36829125b31370dc86ad666b3d5d3071a7 100644
--- a/tests/estimation/hssmc/fs2000.mod
+++ b/tests/estimation/hssmc/fs2000.mod
@@ -91,3 +91,5 @@ estimation(order=1, datafile='../fsdat_simul.m', nobs=192, loglinear,
                                       'target', .25),
 bayesian_irf, smoother, moments_varendo,consider_all_endogenous
 );
+
+generate_trace_plots(1);
\ No newline at end of file