Fix issues with std::min on OSX.