diff --git a/src/runner_doiact_nosort.h b/src/runner_doiact_nosort.h
index 057dd756b4a8d636253eccd8808417ac452e193d..d38f01c6955e2ee9848698d2b46d3f4a14ad0873 100644
--- a/src/runner_doiact_nosort.h
+++ b/src/runner_doiact_nosort.h
@@ -18,15 +18,15 @@ void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, struct cell *cj) {
   if (!cell_is_drifted(ci, e)) cell_drift(ci, e);
   if (!cell_is_drifted(cj, e)) cell_drift(cj, e);
 
+  /* Get the relative distance between the pairs, wrapping. */
+  double shift[3] = {0.0, 0.0, 0.0};
+  space_getsid(e->s, &ci, &cj, shift);
+
   const int count_i = ci->count;
   const int count_j = cj->count;
   struct part *restrict parts_i = ci->parts;
   struct part *restrict parts_j = cj->parts;
 
-  /* Get the relative distance between the pairs, wrapping. */
-  double shift[3] = {0.0, 0.0, 0.0};
-  space_getsid(e->s, &ci, &cj, shift);
-
   /* Loop over the parts in ci. */
   for (int pid = 0; pid < count_i; pid++) {
 
@@ -135,15 +135,15 @@ void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, struct cell *cj) {
   if (!cell_is_drifted(ci, e)) cell_drift(ci, e);
   if (!cell_is_drifted(cj, e)) cell_drift(cj, e);
 
+  /* Get the relative distance between the pairs, wrapping. */
+  double shift[3] = {0.0, 0.0, 0.0};
+  space_getsid(e->s, &ci, &cj, shift);
+
   const int count_i = ci->count;
   const int count_j = cj->count;
   struct part *restrict parts_i = ci->parts;
   struct part *restrict parts_j = cj->parts;
 
-  /* Get the relative distance between the pairs, wrapping. */
-  double shift[3] = {0.0, 0.0, 0.0};
-  space_getsid(e->s, &ci, &cj, shift);
-
   /* Loop over the parts in ci. */
   for (int pid = 0; pid < count_i; pid++) {