BS-10830, add sort keys and fix missing ASC/DESC sort direction