Fixed iterator problem with thrust::transform_reduce.