Second bug fix, to preserve search order