updated incl fix for order by freq