Fixed some sorting issue in SortedItemStreamWriter