fixed dimension issue of mean and variance matrices