fix std:min call, include algorithm and compare same type