Fix for where the undo function would not undo any of the previous inputs