replace open-coded min with min invocation.