fix #22740: removing instrument causes crash