Fix bug for timeseries