fix type of reduce()