this happen often when working badly with memory pointers. if not handle right, it causes leaks that result in this situation. He programmed to erase one position at the end, but he miss the sorting to make sure the position at the end is empty and your item is save. When erased the slot, the item is lost in memory, but when you pick up an item somehow (code) he recover the lost item in memory. pretty odd!