Fix min/max function names to avoid clashes with standard funcs on windows.
Fix another dynamic array allocation.