Improve error catching. Reduction kernel now has distinct input and output arrays