Fix problem with removing objects from array we are iterating through.