Handle reinsertion of items into the same children list.

Fixes failing test.