fixed missing <algorithm> header