Fixes an issue in to_timeseries.