Fix crash when collecting tags