IDEA-97689 Undo causes code corruption