Sum function works for small test case