Problems with more than one lag of a variable

Dear all,
I have the following problem: In the model I am simulating I have for one variable two lags and one lead in one of the equations. The model works fine if I restrict the parameters such that the second lag vanishes, and then type the restricted equation (the one without the second lag) into the code and comment out the unrestricted one. However, if I simulate the unrestricted model, I receive the following statement (this follows the computation of the steady state values, which correspond to my own results, and the check of the eigenvalue/forward looking variables condition, which is fullfilled):

MODEL SIMULATION

??? Index exceeds matrix dimensions.

Error in ==> simk at 164
temp(:,iy__) = temp(:,iy__)-w0*c(j1i,1:ncc1) ;

Error in ==> simul at 60
simk ;

Error in ==> overheadgamma8HF at 243
simul(oo_.dr);

Error in ==> dynare at 49
evalin(‘base’,fname) ;

As I mentioned above, the model works fine with only one lag in that respective equation, thus it seesm that it is the second lag which causes the problem. However, I thought that Dynare does support two lags of variables? Any comments would be much appreciated!
Best,
Ansgar

Dear Ansgar,

could you please post your model or send it to me?
Thanks

Michel