assign i=0 in onReset iteration