diff --git a/src/cell.c b/src/cell.c
index 6d3aa7ce16568c5204514cf6e898e83f64cecc8f..d990ba6f6dcddb0c907a5f50f5e8baf3f7935f18 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -339,9 +339,11 @@ void cell_gunlocktree(struct cell *c) {
  * @brief Sort the parts into eight bins along the given pivots.
  *
  * @param c The #cell array to be sorted.
+ * @param parts_offset Offset of the cell parts array relative to the
+ *        space's parts array, i.e. c->parts - s->parts.
  */
 
-void cell_split(struct cell *c) {
+void cell_split(struct cell *c, ptrdiff_t parts_offset) {
 
   int i, j;
   const int count = c->count, gcount = c->gcount;
@@ -452,7 +454,7 @@ void cell_split(struct cell *c) {
   /* Re-link the gparts. */
   for (int k = 0; k < count; k++)
     if (parts[k].gpart != NULL) {
-      parts[k].gpart->id_or_neg_offset = -k;
+      parts[k].gpart->id_or_neg_offset = -(k + parts_offset);
     }
 
   /* Verify that _all_ the parts have been assigned to a cell. */
diff --git a/src/cell.h b/src/cell.h
index b0451b311fda9c300427da6b3a9a25955090d799..857aa9282930fea330df03992ae140f97ae0f630 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -20,6 +20,9 @@
 #define SWIFT_CELL_H
 
 /* Includes. */
+#include <stddef.h>
+
+/* Local includes. */
 #include "lock.h"
 #include "multipole.h"
 #include "part.h"
@@ -167,7 +170,7 @@ struct cell {
   ((int)(k) + (cdim)[2] * ((int)(j) + (cdim)[1] * (int)(i)))
 
 /* Function prototypes. */
-void cell_split(struct cell *c);
+void cell_split(struct cell *c, ptrdiff_t parts_offset);
 int cell_locktree(struct cell *c);
 void cell_unlocktree(struct cell *c);
 int cell_glocktree(struct cell *c);
diff --git a/src/space.c b/src/space.c
index 286ded6b4af8e1216105b824f6b430007917ea61..ef825545d919a09e12f4891577ef40297c62d1f3 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1100,7 +1100,7 @@ void space_do_split(struct space *s, struct cell *c) {
     }
 
     /* Split the cell data. */
-    cell_split(c);
+    cell_split(c, c->parts - s->parts);
 
     /* Remove any progeny with zero parts. */
     for (int k = 0; k < 8; k++)