Fixed a memory corruption when deleting tags