fix #27921

Fixed one bug, found new.
These bugs with StaffText and InstrumentChange are related to my current work on assigning midi channels to instruments. I wouldn't write about them to an issue tracker, they can disappear or can be fixed by me.