fix search error when i >tokens.length