Fix the build by including <algorithm> header