                                        uint* activityIdentifierD,
                                        uint* mapOriginalToSorted,
                                        uint* originalFreeSurfaceId,
-                                       uint* sortedFreeSurfaceId,
-                                       const size_t numAllMarkers) {
+                                       uint* sortedFreeSurfaceId) {
     uint id = blockIdx.x * blockDim.x + threadIdx.x;
-    if (id >= numAllMarkers)
+    if (id >= numObjectsD.numAllMarkers)
         return;
 
     // Check the activity of this particle

                                         Real* G_i,
                                         uint* cellStart,
                                         uint* cellEnd,
                                         const size_t numFluidMarkers,
                                         const size_t numBounMarkers,
                                         const size_t numRigidMarkers,
                                         uint* indexOfIndex) {
    uint id = blockIdx.x * blockDim.x + threadIdx.x;
    if (id >= numFluidMarkers + numRigidMarkers)
        return;

    uint index = indexOfIndex[id];

        calcKernelSupport<<<numBlocks, numThreads>>>(
            mR4CAST(sortedSphMarkersD->posRadD), mR4CAST(sortedSphMarkersD->rhoPresMuD),
            mR3CAST(sortedKernelSupport), U1CAST(markersProximityD->cellStartD),
            U1CAST(markersProximityD->cellEndD), isErrorD);
        ChUtilsDevice::Sync_CheckError(isErrorH, isErrorD, "calcKernelSupport");
    }

