fix bug with tag substrings