          ***/
 
 
-        int n_total = calc_prefix<DIM2>(prefix, tid,  nchild);              // inclusive scan to compute memory offset of each child (return total # of children)
+        int n_total = calc_prefix<DIM2>(prefix,  nchild);              // inclusive scan to compute memory offset of each child (return total # of children)
         int offset  = prefix[tid];
         offset     += n_offset - nchild;                                  // convert inclusive into exclusive scan for referencing purpose
         __syncthreads();                                                   // thread barrier


        lmem = &MEM_BUF[gridDim.x*(LMEM_STACK_SIZE*blockDim.x + LMEM_EXTRA_SIZE)];    //Use the extra large buffer
        apprCount = direCount = 0;
        acc_i = approximate_gravity<blockDim2, 8>( DIM2x, DIM2y, tid, tx, ty,
            body_i, pos_i, group_pos,
            eps2, node_begend,
            multipole_data, body_pos,

}
#else
  template<int DIM2>
__device__ __forceinline__ int calc_prefix(int* prefix, int value) 
{
    return calc_prefix1<DIM2>(prefix, value);
}
#endif


  template<int DIM2>
__device__ int calc_prefix(int N, int* prefix_in) 
{
  const int DIM = 1 << DIM2;

  int y = calc_prefix<DIM2>(prefix_in, prefix_in[tid]);
  if (N <= DIM) return y;

  for (int p = DIM; p < N; p += DIM) 
  {
    int *prefix = &prefix_in[p];
    const int y1 = calc_prefix<DIM2>(prefix, prefix[tid]);
    prefix[tid] += y;
    y += y1;
  }
