fixed sort ordering bug