       const int2 childScatter = warpIntExclusiveScan(nBody & (-isDirect));
       int nParticle  = childScatter.y;
       int nProcessed = 0;
-      int carryIdx   = 0;
+      int2 scanVal   = {0};
 
       /* conduct segmented scan for all leaves that need to be expanded */
       while (nParticle > 0)

    /**********************************************/

    const bool isNode = cellPos.w > 0.0f;
    bool splitNode  = isNode && splitCell && useCell;

    {
      /* use exclusive scan to compute scatter addresses for each of the child cells */
      const int2 childScatter = warpIntExclusiveScan(nChildren & (-splitNode));


        for (int i = 0; i < nChildren; i++)
          cellList[ringAddr<SHIFT>(scatterIdx + i)] = firstChild + i;
      }
#else  /* use scan operation to accomplish steps above, doesn't bring performance benefit */
      int nChildren  = childScatter.y;
      int nProcessed = 0;
      int2 scanVal   = {0};
      const int offset = cellListOffset + nCells + nextLevelCellCounter;
      while (nChildren > 0)
      {
        tmpList[laneIdx] = 1;
        if (splitNode && (childScatter.x - nProcessed < WARP_SIZE))
        {
          splitNode = false;
          tmpList[childScatter.x - nProcessed] = -1-firstChild;
        }
        scanVal = inclusive_segscan_warp(tmpList[laneIdx], scanVal.y);
        if (laneIdx < nChildren)
          cellList[ringAddr<SHIFT>(offset + nProcessed + laneIdx)] = scanVal.x;
        nChildren  -= WARP_SIZE;
        nProcessed += WARP_SIZE;
      }
#endif
      nextLevelCellCounter += childScatter.y;  /* increment nextLevelCounter by total # of children */
    }

