More improvements.

Most important one, just before performing an undo/redo, make sure there is no
unprocessed changes.