Fix issue removing deleted items from history