solved the undo button bug