Fixed potential error when deleting a parent and its child and undoing.