Enabled Undo and Redo button when necessary