Improved numerical calculation of the variances