patch orderby and distinct