The reason this fails is because of iterators. just replace it with a while loop and trust me.