sort the merged values