fixed the search function, formula before was not correct