fixed sort bug