Improve [max|min]With check