Fixed a data sorting problem