Fixed the sort by with pagination