handle missing values in movingAverage()