Code of function 'mean.ds' amended