minor changes to handle order by stuff