Fixed d_output_valIndex pass by reference bug