diff --git a/matlab/dyn_ramsey_static.m b/matlab/dyn_ramsey_static.m
index 41151537c394e09a431d8b5c5fcde3c508ece002..511f5ed1559772913c362bb0fae4dc98116d9aca 100644
--- a/matlab/dyn_ramsey_static.m
+++ b/matlab/dyn_ramsey_static.m
@@ -55,7 +55,13 @@ elseif options_.steadystate_flag
     end
     if inst_nbr == 1
         %solve for instrument, using univariate solver, starting at initial value for instrument
-        inst_val = csolve(nl_func,ys_init(k_inst),'',options_.solve_tolf,100); 
+        [inst_val, info1]= csolve(nl_func,ys_init(k_inst),'',options_.solve_tolf,options_.ramsey.maxit);
+        if info1==1 || info1==3
+            check=81;
+        end
+        if info1==4
+            check=87;
+        end        
     else
         %solve for instrument, using multivariate solver, starting at
         %initial value for instrument
@@ -63,10 +69,13 @@ elseif options_.steadystate_flag
         opt.jacobian_flag = 0;
         [inst_val,info1] = dynare_solve(nl_func,ys_init(k_inst), ...
                                         opt);
+        if info1~=0
+            check=81;
+        end
     end
     ys_init(k_inst) = inst_val;
     exo_ss = [oo.exo_steady_state oo.exo_det_steady_state];
-    [xx,params,check] = evaluate_steady_state_file(ys_init,exo_ss,M,options_,~options_.steadystate.nocheck); %run steady state file again to update parameters
+    [xx,params] = evaluate_steady_state_file(ys_init,exo_ss,M,options_,~options_.steadystate.nocheck); %run steady state file again to update parameters
     [junk,junk,steady_state] = nl_func(inst_val); %compute and return steady state
 else
     n_var = M.orig_endo_nbr;
@@ -110,6 +119,12 @@ if options_.steadystate_flag
                                                   [oo.exo_steady_state; ...
                                                   oo.exo_det_steady_state], ...
                                                   M,options_,~options_.steadystate.nocheck);
+    if any(imag(x(1:M.orig_endo_nbr))) %return with penalty
+        resids=1+sum(abs(imag(x(1:M.orig_endo_nbr)))); %return with penalty
+        steady_state=NaN(endo_nbr,1);
+        return;
+    end
+
 end
 
 xx = zeros(endo_nbr,1); %initialize steady state vector
diff --git a/matlab/evaluate_steady_state.m b/matlab/evaluate_steady_state.m
index 26f5c3cebc9f77ed69ca76a86f6a04268276025f..0067d27259c168fd7750f9929cb238e0dcd8b3f6 100644
--- a/matlab/evaluate_steady_state.m
+++ b/matlab/evaluate_steady_state.m
@@ -145,7 +145,6 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
         %either if no steady state file or steady state file without problems
         [ys,params,info] = dyn_ramsey_static(ys_init,M,options,oo);
         if info
-           info=81;%case should not happen
            return;
         end
         %check whether steady state really solves the model
diff --git a/matlab/print_info.m b/matlab/print_info.m
index 1457e39458224984b65155c81fa9cdbf0f841218..af5b40fc8d6a21948b5c080ac8c9ee4fe6afa375 100644
--- a/matlab/print_info.m
+++ b/matlab/print_info.m
@@ -148,6 +148,10 @@ if ~noprint
         error(['Ramsey: The steady state file computation for the Ramsey problem resulted in NaNs at the initial values of the instruments']);
       case 85
         error(['Ramsey: The steady state file does not solve the static first order conditions conditional on the instruments.']);
+      case 86
+        error(['Ramsey: The steady state file provides complex numbers conditional on the instruments.']);
+      case 87
+        error(['Ramsey: The maximum number of iterations has been reached. Try increasing maxit.']);
       case 102
         error('Aim: roots not correctly computed by real_schur');
       case 103