Fix tid bug in tag.py