scripting: include <algorithm> as appropriate