Correct the implementation of accumulate (for real this time).