fix sorting issue