Import bug fixes and improvements from time series development branch.