fixed bug in reduce with shared buffers