Fixed bug with undo operations. Fixes #23