diff --git a/examples/main.c b/examples/main.c
index 9cb21428174a235178372b0e66c0b4d9ba21dce3..959343de40d87cf502317e03908dc203c4ddb97e 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -394,7 +394,7 @@ int main(int argc, char *argv[]) {
                    MPI_COMM_WORLD, MPI_INFO_NULL, dry_run);
 #else
   read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &Ngas, &Ngpart,
-                 &Nsparts, &periodic, &flag_entropy_ICs, with_hydro,
+                 &Nspart, &periodic, &flag_entropy_ICs, with_hydro,
                  (with_external_gravity || with_self_gravity), with_stars,
                  myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, dry_run);
 #endif
diff --git a/src/serial_io.c b/src/serial_io.c
index fc54e348ca876e30365f5b201967b17c19dbf946..a456d4faf3c465962661f1c69e4af4963b5edbd7 100644
--- a/src/serial_io.c
+++ b/src/serial_io.c
@@ -46,6 +46,7 @@
 #include "io_properties.h"
 #include "kernel_hydro.h"
 #include "part.h"
+#include "stars_io.h"
 #include "units.h"
 
 /*-----------------------------------------------------------------------------
@@ -952,7 +953,7 @@ void write_output_serial(struct engine* e, const char* baseName,
             break;
 
           case STAR:
-            N = Nstars;
+            Nparticles = Nstars;
             star_write_particles(sparts, list, &num_fields);
             break;