fixed mem leak on undo / redo