Fix safe updating of items

Check for concurrent modifications and handle more cleanly.