Fixes lots of little issues with the new undo functionality