update min and max with reduce