Dealing with gaps in time series