diff --git a/src/serial_io.c b/src/serial_io.c
index 9804a7012b0e9d29e837d8383147caa66b059ce2..c9b08c6e658c9915e7992fc4d4cbd58924dcc3cb 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -742,7 +742,7 @@ void write_output_serial(struct engine* e, struct UnitSystem* us, int mpi_rank,
       for (int ptype = 0; ptype < NUM_PARTICLE_TYPES; ptype++) {
 
         /* Don't do anything if no particle of this kind */
-        if (N[ptype] == 0) continue;
+        if (N_total[ptype] == 0) continue;
 
         /* Open the particle group in the file */
         char partTypeGroupName[PARTICLE_GROUP_BUFFER_SIZE];