handle empty sorting