Fix bug in ace-low sorting function