Fix a bug where delete->undo->delete had issues

The undo adds a new task instead of deleting the old.