Fixed bug when generating tag text