Fixed sort in active_record adapter