Fix deprecation warnings for min and max