minor improvement to token matching