fix sorting problem