Fixed problem with tags that appear more than once in the tag string