average_history: bug fix