 
 #pragma unroll 16
           for (int i = 0; i < WARP_SIZE; i++)
-            acc_i = add_acc(acc_i, pos_i, sh_mass[offs + i], sh_pos[offs+i], eps2);
-          apprCount += WARP_SIZE;
+            for (int k = 0; k < NI; k++)
+              acc_i[k] = add_acc(acc_i[k], pos_i[k], sh_mass[offs + i], sh_pos[offs+i], eps2);
+          apprCount += WARP_SIZE*NI;
         }
 #endif
 

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


template<int SHIFT, int BLOCKDIM2>
__device__ float4 approximate_gravity(
    int body_i, float4 pos_i,
    real4 group_pos,
    float eps2,
    uint2 node_begend,

    float4 groupSize,
    volatile float4 *boxCenterInfo,
    float group_eps,
    real4 acc_i[NI])
{


  /*********** set necessary thread constants **********/
