Fixed bug where sometimes the mean of a vector of NAs was attempted to be computed