properly counting tasks and agents and adding them to result log file