Fix std::max compile error

The parameters to std::max need to be the same type to comply with the template definition