ForIn fix, before i kept the index of the next property to be iterated, but the problem is what if the current property is deleted in the forIn loop then the next property should not be +1, but the with the same index. I ended by rewriting it to fetch a list of property names at first iteration (and at each next to add new properties if available), and then to remove from that list as the property is consumed