diff --git a/examples/main_fof.c b/examples/main_fof.c
index 1672cdacd5322d8c18922c1b9784f779e776c0ac..b2cdbe7b7be88d442303d0c35a943ef16ff4f8ae 100644
--- a/examples/main_fof.c
+++ b/examples/main_fof.c
@@ -428,28 +428,31 @@ int main(int argc, char *argv[]) {
 
   /* Get ready to read particles of all kinds */
   int flag_entropy_ICs = 0;
-  size_t Ngas = 0, Ngpart = 0, Nspart = 0, Nbpart = 0;
+  size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
   double dim[3] = {0., 0., 0.};
   if (myrank == 0) clocks_gettime(&tic);
 #if defined(HAVE_HDF5)
 #if defined(WITH_MPI)
 #if defined(HAVE_PARALLEL_HDF5)
   read_ic_parallel(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts,
-                   &Ngas, &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs,
-                   with_hydro, /*with_grav=*/1, with_stars, with_black_holes,
-                   cleanup_h, cleanup_sqrt_a, cosmo.h, cosmo.a, myrank,
-                   nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads,
+                   &Ngas, &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
+                   &flag_entropy_ICs, with_hydro, /*with_grav=*/1, with_stars,
+                   with_black_holes, cleanup_h, cleanup_sqrt_a, cosmo.h,
+                   cosmo.a, myrank, nr_nodes, MPI_COMM_WORLD, MPI_INFO_NULL,
+                   nr_threads,
                    /*dry_run=*/0);
 #else
   read_ic_serial(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
-                 &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro,
+                 &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
+                 &flag_entropy_ICs, with_hydro,
                  /*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
                  cleanup_sqrt_a, cosmo.h, cosmo.a, myrank, nr_nodes,
                  MPI_COMM_WORLD, MPI_INFO_NULL, nr_threads, /*dry_run=*/0);
 #endif
 #else
   read_ic_single(ICfileName, &us, dim, &parts, &gparts, &sparts, &bparts, &Ngas,
-                 &Ngpart, &Nspart, &Nbpart, &flag_entropy_ICs, with_hydro,
+                 &Ngpart, &Ngpart_background, &Nspart, &Nbpart,
+                 &flag_entropy_ICs, with_hydro,
                  /*with_grav=*/1, with_stars, with_black_holes, cleanup_h,
                  cleanup_sqrt_a, cosmo.h, cosmo.a, nr_threads, /*dry_run=*/0);
 #endif
@@ -468,30 +471,46 @@ int main(int argc, char *argv[]) {
 #endif
 
   /* Get the total number of particles across all nodes. */
-  long long N_total[4] = {0, 0, 0};
+  long long N_total[swift_type_count + 1] = {0};
+  const long long Nbaryons = Ngas + Nspart + Nbpart;
 #if defined(WITH_MPI)
-  long long N_long[4] = {Ngas, Ngpart, Nspart, Nbpart};
-  MPI_Allreduce(&N_long, &N_total, 4, MPI_LONG_LONG_INT, MPI_SUM,
-                MPI_COMM_WORLD);
+  long long N_long[swift_type_count + 1] = {0};
+  N_long[swift_type_gas] = Ngas;
+  N_long[swift_type_dark_matter] = Ngpart - Ngpart_background - Nbaryons;
+  N_long[swift_type_dark_matter_background] = Ngpart_background;
+  N_long[swift_type_stars] = Nspart;
+  N_long[swift_type_black_hole] = Nbpart;
+  N_long[swift_type_count] = Ngpart;
+  MPI_Allreduce(&N_long, &N_total, swift_type_count + 1, MPI_LONG_LONG_INT,
+                MPI_SUM, MPI_COMM_WORLD);
 #else
-  N_total[0] = Ngas;
-  N_total[1] = Ngpart;
-  N_total[2] = Nspart;
-  N_total[3] = Nbpart;
+  N_total[swift_type_gas] = Ngas;
+  N_total[swift_type_dark_matter] = Ngpart - Ngpart_background - Nbaryons;
+  N_total[swift_type_dark_matter_background] = Ngpart_background;
+  N_total[swift_type_stars] = Nspart;
+  N_total[swift_type_black_hole] = Nbpart;
+  N_total[swift_type_count] = Ngpart;
 #endif
 
   if (myrank == 0)
     message(
         "Read %lld gas particles, %lld stars particles, %lld black hole "
-        "particles and %lld gparts from the ICs.",
-        N_total[0], N_total[2], N_total[3], N_total[1]);
+        "particles, %lld DM particles and %lld DM background particles from "
+        "the ICs.",
+        N_total[swift_type_gas], N_total[swift_type_stars],
+        N_total[swift_type_black_hole], N_total[swift_type_dark_matter],
+        N_total[swift_type_dark_matter_background]);
+
+  /* Do we have background DM particles? */
+  const int with_DM_background_particles =
+      N_total[swift_type_dark_matter_background] > 0;
 
   /* Initialize the space with these data. */
   if (myrank == 0) clocks_gettime(&tic);
   space_init(&s, params, &cosmo, dim, parts, gparts, sparts, bparts, Ngas,
              Ngpart, Nspart, Nbpart, periodic, replicate,
              /*generate_gas_in_ics=*/0, /*hydro=*/N_total[0] > 0, /*gravity=*/1,
-             /*with_star_formation=*/0, talking,
+             /*with_star_formation=*/0, with_DM_background_particles, talking,
              /*dry_run=*/0);
 
   if (myrank == 0) {
diff --git a/src/fof.c b/src/fof.c
index c7c9323a3ed0e5c52cf09c2644c3754e6126a24f..44e9fa6e1f5d86f745e8e8d46414ca69ac10d9dd 100644
--- a/src/fof.c
+++ b/src/fof.c
@@ -1956,12 +1956,12 @@ void fof_dump_group_data(const struct fof_props *props,
                                   : -1;
 #ifdef WITH_MPI
     fprintf(file, "  %8zu %12zu %12e %12e %18lld %18lld\n",
-            gparts[group_offset - node_offset].fof_data.group_id,
+            (size_t)gparts[group_offset - node_offset].fof_data.group_id,
             group_size[group_offset - node_offset], group_mass[i],
             max_part_density[i], max_part_density_index[i], part_id);
 #else
     fprintf(file, "  %8zu %12zu %12e %12e %18lld %18lld\n",
-            gparts[group_offset].fof_data.group_id, group_size[group_offset],
+            (size_t)gparts[group_offset].fof_data.group_id, group_size[group_offset],
             group_mass[i], max_part_density[i], max_part_density_index[i],
             part_id);
 #endif