Fix order by bug