Fixed sort by bug.