Updated local_min_max to fix an issue with box search