fix sum-of-sqauares defect
improve tests for variance and sum-of-squares