Fixed sum and average mapreduce for issue: #375

I hope this is OK. If there is a better method let me know.
For Issue: #375