Partial sum implementation

I've fixed this and added a test to cover this case.