fixed segfault for foreman mode related to tracking the average duration of tasks