Now we make sure that the minimum value can not be greater than the maximum value