fix an abort when undoing a remove, but create a memory leak for that :/