modifications to search_max_int, still not reliable