It's generally considered bad form to change the size of an array while you're iterating through it. You try walking while someone else keeps replacing your boots. I doubt that last is having any effect -- it's more likely that the array runs out of elements after five passes.