   float *input_k = input + k*nInput;
   float *nodeGradOutput, *nodeGradWeight, *nodeGradBias;
   // reuse _multiBuffer for keeping track of which node gets gradients
-  float *nodeUpdate = nodeUpdateCuda + maxDept*k; 
+  int *nodeUpdate = nodeUpdateCuda + maxDept*k; 
   int childId = target[k] - 1;
   int parentId, parentIdx, nChildren;
   float *node;

  cunnx_SoftMaxTree_accGradParameters_kernel<<<blocks,threads>>>(
    THCudaTensor_data(state, gradWeight), THCudaTensor_data(state, gradBias), 
    THCudaTensor_data(state, input), THCudaTensor_data(state, linearGradOutput), 
    (float *)THCudaIntTensor_data(state, nodeUpdateCuda), THCudaTensor_data(state, target), 
    THCudaTensor_data(state, childParent), THCudaTensor_data(state, parentChildren), 
    input->size[1], rootId, maxFamilyPath, maxDept, scale 
  );

    }
    
    // keep track of which node gets gradients
    nodeUpdate[m] = (int)parentId;
    
    n += nChildren;
    CudaAssert((n <= maxFamilyPath))
