Fixed bug in _collect_tags.