fix #25394, fix #25457: do not sort notes in chord while looping through notes in chord