Fix #13: Fixed bug in variance calculation