diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m
index fc220af0da6187c8e4dd0372bb3892abfed1245c..a66ed7821f5126021e7be8e12d60b7fd139d2322 100644
--- a/matlab/dynare_estimation_init.m
+++ b/matlab/dynare_estimation_init.m
@@ -335,7 +335,7 @@ nvx = estim_params_.nvx;
 ncx = estim_params_.ncx;
 nvn = estim_params_.nvn;
 ncn = estim_params_.ncn;
-if ~isempty(estim_params_.param_vals)
+if estim_params_.np
   M.params(estim_params_.param_vals(:,1)) = xparam1(nvx+ncx+nvn+ncn+1:end);
 end;
 oo_.steady_state = evaluate_steady_state(oo_.steady_state,M,options_,oo_,steadystate_check_flag);
diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m
index 6c2cbe7eb28724003dd39632f5fce08a7d25fd09..91b59e6e352535dd90c641d5c1ebb4f88544a525 100644
--- a/matlab/initial_estimation_checks.m
+++ b/matlab/initial_estimation_checks.m
@@ -51,6 +51,11 @@ end
 %         error('Options mode_compute=5 is not compatible with non linear filters or Dsge-VAR models!')
 %     end
 % end
+if isnan(fval)
+    error('The initial value of the likelihood is NaN')
+elseif imag(fval)
+    error('The initial value of the likelihood is complex')
+end
 
 if info(1) > 0
     disp('Error in computing likelihood for initial parameter values')
diff --git a/matlab/set_prior.m b/matlab/set_prior.m
index 2d3f4534448dc62d2c6c6b98564ccfcdee9f2c10..23cf6a5881d02b69932b925d07ff17e59dd6e143 100644
--- a/matlab/set_prior.m
+++ b/matlab/set_prior.m
@@ -94,11 +94,7 @@ if nvn
     bayestopt_.p3 = [ bayestopt_.p3; estim_params_.var_endo(:,8)];
     bayestopt_.p4 = [ bayestopt_.p4; estim_params_.var_endo(:,9)];
     bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.var_endo(:,10)];
-    if isempty(bayestopt_.name)
-        bayestopt_.name = cellstr(char(options_.varobs(estim_params_.var_endo(:,1),:)));
-    else
-        bayestopt_.name = cellstr(char(char(bayestopt_.name), options_.varobs(estim_params_.var_endo(:,1),:)));
-    end
+    bayestopt_.name = [ bayestopt_.name; cellstr(options_.varobs(estim_params_.var_endo(:,1),:))];
 end
 if ncx
     xparam1 = [xparam1; estim_params_.corrx(:,3)];
@@ -110,13 +106,9 @@ if ncx
     bayestopt_.p3 = [ bayestopt_.p3; estim_params_.corrx(:,9)];
     bayestopt_.p4 = [ bayestopt_.p4; estim_params_.corrx(:,10)];
     bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.corrx(:,11)];
-    if isempty(bayestopt_.name)
-        bayestopt_.name = cellstr(char(char(strcat(cellstr(M_.exo_names(estim_params_.corrx(:,1),:)), ...
-                                                   ',' , cellstr(M_.exo_names(estim_params_.corrx(:,2),:))))));
-    else
-        bayestopt_.name = cellstr(char(char(bayestopt_.name), char(strcat(cellstr(M_.exo_names(estim_params_.corrx(:,1),:)), ...
-                                                          ',' , cellstr(M_.exo_names(estim_params_.corrx(:,2),:))))));
-    end
+    bayestopt_.name = [bayestopt_.name; cellstr(['corr ' ...
+                        deblank(M_.exo_names(estim_params_.corrx(:,1),:)) ...
+                        ', ' , deblank(M_.exo_names(estim_params_.corrx(:,2),:))])];
 end
 if ncn
     if isequal(M_.H,0)
@@ -132,13 +124,9 @@ if ncn
     bayestopt_.p3 = [ bayestopt_.p3; estim_params_.corrn(:,9)];
     bayestopt_.p4 = [ bayestopt_.p4; estim_params_.corrn(:,10)];
     bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.corrn(:,11)];
-    if isempty(bayestopt_.name)
-        bayestopt_.name = cellstr(char(char(strcat(cellstr(M_.endo_names(estim_params_.corrn(:,1),:)),...
-                                                   ',' ,  cellstr(M_.endo_names(estim_params_.corrn(:,2),:))))));
-    else
-        bayestopt_.name = cellstr(char(char(bayestopt_.name), char(strcat(cellstr(M_.endo_names(estim_params_.corrn(:,1),:)),...
-                                                          ',' ,  cellstr(M_.endo_names(estim_params_.corrn(:,2),:))))));
-    end
+    bayestopt_.name = [bayestiopt_.name; cellstr(['corr ' ...
+                        deblank(M_.exo_names(estim_params_.corrn(:,1),:)) ...
+                        ', ' , deblank(M_.exo_names(estim_params_.corrn(:,2),:))])];
 end
 if np
     xparam1 = [xparam1; estim_params_.param_vals(:,2)];
@@ -150,11 +138,7 @@ if np
     bayestopt_.p3 = [ bayestopt_.p3; estim_params_.param_vals(:,8)];
     bayestopt_.p4 = [ bayestopt_.p4; estim_params_.param_vals(:,9)];
     bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.param_vals(:,10)];
-    if isempty(bayestopt_.name)
-        bayestopt_.name = cellstr(char(M_.param_names(estim_params_.param_vals(:,1),:)));
-    else
-        bayestopt_.name = cellstr(char(char(bayestopt_.name),M_.param_names(estim_params_.param_vals(:,1),:)));
-    end
+    bayestopt_.name = [bayestopt_.name; cellstr(M_.param_names(estim_params_.param_vals(:,1),:))];
 end
 
 bayestopt_.ub = ub;
@@ -175,6 +159,11 @@ for i=1:length(k)
     end
     mu = (bayestopt_.p1(k(i))-bayestopt_.p3(k(i)))/(bayestopt_.p4(k(i))-bayestopt_.p3(k(i)));
     stdd = bayestopt_.p2(k(i))/(bayestopt_.p4(k(i))-bayestopt_.p3(k(i)));
+    if stdd^2 > (1-mu)*mu
+        error(sprintf(['Error in prior for %s: in a beta distribution with ' ...
+                       'mean %f, the standard error can''t be larger than' ...
+                       ' %f.'], bayestopt_.name{k(i)},mu,sqrt((1-mu)*mu)))
+    end
     bayestopt_.p6(k(i)) = (1-mu)*mu^2/stdd^2 - mu ;
     bayestopt_.p7(k(i)) = bayestopt_.p6(k(i))*(1/mu-1) ;
     m = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) , bayestopt_.p4(k(i)) ],1);