     /* get next Node in Tree */
     node = childParent + childId*2;
     parentId = (int)node[0] - 1;
-    childIdx = (int)node[1] - 1;
     
     node = parentChildren + parentId*2;
     parentIdx = (int)node[0] - 1;

  // reuse _multiBuffer for keeping track of which node gets gradients
  float *nodeUpdate = nodeUpdateCuda + maxDept*k; 
  int childId = target[k] - 1;
  int parentId, parentIdx, childIdx, nChildren;
  float *node;
  int n = 0;
  int m = 0;

  THCudaTensor *gradWeight = (THCudaTensor*)luaT_getfieldcheckudata(L, 1, "gradWeight", "torch.CudaTensor");
  THCudaTensor *gradBias = (THCudaTensor*)luaT_getfieldcheckudata(L, 1, "gradBias", "torch.CudaTensor");
  
  int i, j;
  THIntTensor *nodeUpdate;
  
  lua_getfield(L, 1, "updates");
  
  luaL_argcheck(L, input->nDimension == 2, 2, "2D(batch mode) tensor expected");
  luaL_argcheck(L, input->size[1] == inputSize, 2, "invalid input size");  
