Fix a potential crash when undo-ing after recording...