Fixed reduce function when called with init value