Fix the XPath expressions used by tags to handle the case were a tag matches the flag