fixing NaN bug in history widget