diff --git a/matlab/block_bytecode_mfs_steadystate.m b/matlab/block_bytecode_mfs_steadystate.m
index fd944f5cc79a41083260332d96c3e7a68b45278a..d06fb1b8b247a65411f2f9e8c04bc33f675557b2 100644
--- a/matlab/block_bytecode_mfs_steadystate.m
+++ b/matlab/block_bytecode_mfs_steadystate.m
@@ -23,4 +23,4 @@ global M_ oo_
 indx = M_.blocksMFS{b};
 y_all(indx) = y;
 x = [oo_.exo_steady_state; oo_.exo_det_steady_state];
-[chk, r, g1] = bytecode( y_all, x, M_.params, 1, y_all, 'evaluate', 'static', ['block = ' int2str(b) ]);
+[chk, r, g1] = bytecode( y_all, x, M_.params, y_all, 1, y_all, 'evaluate', 'static', ['block = ' int2str(b) ]);
diff --git a/matlab/bytecode_steadystate.m b/matlab/bytecode_steadystate.m
index 92c79fe3f3a43d504da19eb9a1ee72027e836621..2aa2715a31ba7d4714d872273f840d647cc3d71b 100644
--- a/matlab/bytecode_steadystate.m
+++ b/matlab/bytecode_steadystate.m
@@ -21,4 +21,4 @@ function [r, g1] = bytecode_steadystate(y)
 
 global M_ oo_
 x = [oo_.exo_steady_state; oo_.exo_det_steady_state];
-eval('[chk, r, g1] = bytecode( y, x, M_.params, 1, x, ''evaluate'', ''static'', ''block = 1'');');
\ No newline at end of file
+eval('[chk, r, g1] = bytecode( y, x, M_.params, oo_.steady_state, 1, x, ''evaluate'', ''static'', ''block = 1'');');
\ No newline at end of file
diff --git a/matlab/dr1.m b/matlab/dr1.m
index 9ebad62d03f389d03d9cebb0e12b698cb856c859..da08dc85226e5b2986c7508e4e06c18579b10e74 100644
--- a/matlab/dr1.m
+++ b/matlab/dr1.m
@@ -159,7 +159,7 @@ else
     if options_.order == 1
         if (options_.bytecode)
             [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ...
-                                oo_.exo_det_simul], M_.params, 1);
+                                oo_.exo_det_simul], M_.params, dr.ys, 1);
             jacobia_ = [loc_dr.g1 loc_dr.g1_x];
         else
             [junk,jacobia_] = feval([M_.fname '_dynamic'],z,[oo_.exo_simul ...
@@ -168,7 +168,7 @@ else
     elseif options_.order == 2
         if (options_.bytecode)
             [chck, junk, loc_dr] = bytecode('dynamic','evaluate', z,[oo_.exo_simul ...
-                                oo_.exo_det_simul], M_.params, 1);
+                                oo_.exo_det_simul], M_.params, dr.ys, 1);
             jacobia_ = [loc_dr.g1 loc_dr.g1_x];
         else
             [junk,jacobia_,hessian1] = feval([M_.fname '_dynamic'],z,...
diff --git a/matlab/dynare_solve_block_or_bytecode.m b/matlab/dynare_solve_block_or_bytecode.m
index e49bea2d400f3f47b071591be919a79852231885..7e5a9c9aa111664b0cfc7dbe864a6940aff072b8 100644
--- a/matlab/dynare_solve_block_or_bytecode.m
+++ b/matlab/dynare_solve_block_or_bytecode.m
@@ -59,7 +59,7 @@ elseif options_.bytecode
                 end
                 x(M_.blocksMFS{b}) = y;
             else
-                [chk, nulldev, nulldev1, x] = bytecode( x, exo, params, 1, x, 'evaluate', 'static', ['block = ' int2str(b)]);
+                [chk, nulldev, nulldev1, x] = bytecode( x, exo, params, x, 1, x, 'evaluate', 'static', ['block = ' int2str(b)]);
             end;
         end
     else
diff --git a/matlab/steady_.m b/matlab/steady_.m
index 3d0cd580bd8ed183d60f03fe7c7860cd50772f61..f090816d7f082d32307a6bbb2009b5347e82a414 100644
--- a/matlab/steady_.m
+++ b/matlab/steady_.m
@@ -88,7 +88,7 @@ if options_.steadystate_flag
         elseif options_.bytecode
             [check1, residuals] = bytecode('evaluate','static',oo_.steady_state,...
                                            [oo_.exo_steady_state; ...
-                                oo_.exo_det_steady_state], M_.params, 1);
+                                oo_.exo_det_steady_state], M_.params, oo_.steady_state, 1);
             mexErrCheck('bytecode', check1);
             check1 = max(abs(residuals)) > options_.dynatol ;
         else
diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index 965766267c1f26dd9940b5103552ec36b5a46c33..d46335fdf1e6fc205cff5246cb3381743f81e5e8 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -59,7 +59,9 @@ Get_Arguments_and_global_variables(int nrhs,
                                    int &count_array_argument,
                                    double *yd[], unsigned int &row_y, unsigned int &col_y,
                                    double *xd[], unsigned int &row_x, unsigned int &col_x,
-                                   double *params[], unsigned int &periods,
+                                   double *params[], 
+                                   double *steady_yd[], unsigned int &steady_row_y, unsigned int &steady_col_y,
+                                   unsigned int &periods,
 #ifndef DEBUG_EX
                                    mxArray *block_structur[],
 #endif
@@ -93,12 +95,17 @@ Get_Arguments_and_global_variables(int nrhs,
                 *params = mxGetPr(prhs[i]);
                 break;
               case 3:
-                periods = mxGetScalar(prhs[i]);
+                *steady_yd = mxGetPr(prhs[i]);
+                steady_row_y = mxGetM(prhs[i]);
+                steady_col_y = mxGetN(prhs[i]);
                 break;
               case 4:
-                *block_structur = mxDuplicateArray(prhs[i]);
+                periods = mxGetScalar(prhs[i]);
                 break;
               case 5:
+                *block_structur = mxDuplicateArray(prhs[i]);
+                break;
+              case 6:
                 global_temporary_terms = true;
                 *GlobalTemporaryTerms = mxDuplicateArray(prhs[i]);
                 break;
@@ -140,14 +147,14 @@ Get_Arguments_and_global_variables(int nrhs,
                 }
             }
       }
-  if (count_array_argument > 0 && count_array_argument < 4)
+  if (count_array_argument > 0 && count_array_argument < 5)
     {
       if (count_array_argument == 3 && steady_state)
         periods = 1;
       else
         {
           ostringstream tmp;
-          tmp << " in main, missing arguments. All the following arguments have to be indicated y, x, params, it_\n";
+          tmp << " in main, missing arguments. All the following arguments have to be indicated y, x, params, it_, ys\n";
           throw FatalExceptionHandling(tmp.str());
         }
     }
@@ -195,7 +202,7 @@ main(int nrhs, const char *prhs[])
 #endif
   //ErrorHandlingException error_handling;
   unsigned int i, row_y = 0, col_y = 0, row_x = 0, col_x = 0, nb_row_xd = 0;
-  int steady_row_y, steady_col_y, steady_row_x, steady_col_x, steady_nb_row_xd;
+  unsigned int steady_row_y, steady_col_y, steady_row_x, steady_col_x, steady_nb_row_xd;
   int y_kmin = 0, y_kmax = 0, y_decal = 0;
   unsigned int periods = 1;
   double *direction;
@@ -207,13 +214,16 @@ main(int nrhs, const char *prhs[])
   int count_array_argument = 0;
   bool global_temporary_terms = false;
   bool print = false;
-
+  double *steady_yd = NULL, *steady_xd = NULL;
+  
   try
     {
       Get_Arguments_and_global_variables(nrhs, prhs, count_array_argument,
                                          &yd, row_y, col_y,
                                          &xd, row_x, col_x,
-                                         &params, periods,
+                                         &params, 
+                                         &steady_yd, steady_row_y, steady_col_y,
+                                         periods,
 #ifndef DEBUG_EX
                                          &block_structur,
 #endif
@@ -229,7 +239,7 @@ main(int nrhs, const char *prhs[])
   if (!count_array_argument)
     params = mxGetPr(mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_, "params")));
 
-  double *steady_yd = NULL, *steady_xd = NULL;
+  
   if (!steady_state)
     {
       if (!count_array_argument)
@@ -248,10 +258,12 @@ main(int nrhs, const char *prhs[])
       y_decal = max(0, y_kmin-int (floor(*(mxGetPr(mxGetFieldByNumber(M_, 0, mxGetFieldNumber(M_, "maximum_endo_lag")))))));
       if (!count_array_argument)
         periods = int (floor(*(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "periods"))))));
-
-      steady_yd = mxGetPr(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
-      steady_row_y = mxGetM(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
-      steady_col_y = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));;
+      if (!steady_yd )
+        {
+          steady_yd = mxGetPr(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
+          steady_row_y = mxGetM(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
+          steady_col_y = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));;  
+        }
       steady_xd = mxGetPr(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));
       steady_row_x = mxGetM(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));
       steady_col_x = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));