fixed bug of reduce.