fixed usage of unix sort through system()