I dont know much about spells and stuff, but could it be the fault that you do not count i +1 at then end of a loop, because you say for 0, 3 do?
So I understand it as following: do the loop 4 times -- 0,1,2,3 -- ?
end of the for-loop -> i++
or what ever it is called in the programming language.