Fixed Bug for collisions in the reduce functions