Undo fixes and a (tiny) behaviour adjustment

Fixes a crash in the current master when attempting to undo any action. Crash was introduced in cde721f.