Add Unit test for optimized sum of squares (after fixing a bug..)