corrected.var function

Corrected variance function