change sort algorithm to make iOS sort properly