Fixed bug caused by typo in canUndo function.