diff --git a/matlab/evaluate_steady_state.m b/matlab/evaluate_steady_state.m
index 00eac444c6bc9f8b39ee242fbbfcfa5b1ced2986..d369d9586bcffa13deb41acd287b4098fe382eb4 100644
--- a/matlab/evaluate_steady_state.m
+++ b/matlab/evaluate_steady_state.m
@@ -127,14 +127,22 @@ if options.ramsey_policy
         end
     end
     if options.debug
-        infrow=find(isinf(ys_init));
+        if steadystate_flag
+            infrow=find(isinf(ys_init(1:M.orig_endo_nbr)));
+        else
+            infrow=find(isinf(ys_init));
+        end
         if ~isempty(infrow)
             fprintf('\nevaluate_steady_state: The initial values for the steady state of the following variables are Inf:\n');
             for iter=1:length(infrow)
                 fprintf('%s\n',M.endo_names{infrow(iter)});
             end
         end
-        nanrow=find(isnan(ys_init));
+        if steadystate_flag
+            nanrow=find(isnan(ys_init(1:M.orig_endo_nbr)));
+        else
+            nanrow=find(isnan(ys_init));
+        end
         if ~isempty(nanrow)
             fprintf('\nevaluate_steady_state: The initial values for the steady state of the following variables are NaN:\n');
             for iter=1:length(nanrow)