in reply to push in for loop

Don't change the array over which you are iterating with for. It's a known limitation.