fix bugs of the variance