SortLib: some bugs fixed