fix performance regression in reduce()
resolve merge conflicts
Merge pull request #31 from codemix/reduce

fix performance regression in reduce()