diff --git a/src/space.c b/src/space.c
index b4b5a79404d005afd403ba3f978ef846a977a8a6..fa2541c2872c38f5000e78ef2802d9a4f719f9fc 100644
--- a/src/space.c
+++ b/src/space.c
@@ -1153,7 +1153,7 @@ void space_do_split(struct space *s, struct cell *c) {
   }
 
   /* Set ownership according to the start of the parts array. */
-  if (count > 0)
+  if (s->nr_parts > 0)
     c->owner =
         ((c->parts - s->parts) % s->nr_parts) * s->nr_queues / s->nr_parts;
   else