bugfix in range in find_max_ind