Fix sorting problem in iOS app