bugs in the reduce step