fix sorting issue on search