Edited lambda code

Was passing in "i" instead of sum to the function object.