fixed sort by bug