Added a tiny detail in undo() method