Variance algorithm fixed