Ramsey_policy and lagged interest rate

I’m experimenting with the test file provided in the OptimalPolicy page in DynareWiki. If I change the equation:

y = delta * y(-1) + (1-delta) * y(+1) + sigma *(r - inf(+1)) + y_;

to use a lagged interest rate:

y = delta * y(-1) + (1-delta) * y(+1) + sigma *(r(-1) - inf(+1)) + y_;

then I get the following error message:

??? Subscript indices must either be real positive integers or logicals.

If instead I try to write something equivalent by modifying all the equations to advance all the other endogenous variables by one lag, i.e.

y(+1) = delta * y + (1-delta) * y(+2) + sigma *(r - inf(+2)) + y_;

then ramsey_policy runs successfully. But is it really legitimate to do this?