replace min and max with minimum and maximum