CRM-13467 - cleanup, order-by fixes