fix err (add #include <algorithm>)