Fix sorting. fix #1