Only allow ordering by selected columns; fix bug with group by.