avoid sorting fail  on an empty result set