fixed bugs in tagging