get rid of unnecessary i=0