diff --git a/src/npair_halffull_newtoff.cpp b/src/npair_halffull_newtoff.cpp
index 9d5a15316b80ee3c7d40c83b6581592b99e22829..27edb8aa56d70114095d03fb9279ff1e9e1cdd3c 100644
--- a/src/npair_halffull_newtoff.cpp
+++ b/src/npair_halffull_newtoff.cpp
@@ -52,6 +52,7 @@ void NPairHalffullNewtoff::build(NeighList *list)
   int inum_full = list->listfull->inum;
   if (list->ghost) inum_full += list->listfull->gnum;
 
+  int inum = 0;
   ipage->reset();
 
   // loop over atoms in full list
@@ -72,7 +73,7 @@ void NPairHalffullNewtoff::build(NeighList *list)
       if (j > i) neighptr[n++] = joriginal;
     }
 
-    ilist[ii] = i;
+    ilist[inum++] = i;
     firstneigh[i] = neighptr;
     numneigh[i] = n;
     ipage->vgot(n);
@@ -80,6 +81,13 @@ void NPairHalffullNewtoff::build(NeighList *list)
       error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
   }
 
-  list->inum = list->listfull->inum;
-  list->gnum = list->listfull->gnum;
+  list->inum = inum;
+  if (list->ghost) {
+    int num = 0;
+    for (i = 0; i < inum; i++)
+      if (ilist[i] < nlocal) num++;
+      else break;
+    list->inum = num;
+    list->gnum = inum - num;
+  }
 }