debugged error with counter of finished tasks after undo