Bugfix in time_avg