fix the tag function