support scalar and list sort variants