Fixing array reduce call