fix a sorting problem that was breaking py3x