Fix variance function