Fixed sort() on MacOSX