diff --git a/src/runner_doiact.h b/src/runner_doiact.h
index 9bce0de7a01875784d675d219c9b60449ff10051..f938fc54d4f62a2e6360d85ed24ee6b659220c03 100644
--- a/src/runner_doiact.h
+++ b/src/runner_doiact.h
@@ -915,7 +915,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
     const float d = p->x[0] * runner_shift[sid][0] +
                     p->x[1] * runner_shift[sid][1] +
                     p->x[2] * runner_shift[sid][2];
-    if (fabsf(d - sort_i[pid].d) - ci->dx_max_sort > 1.0e-6)
+    if (fabsf(d - sort_i[pid].d) - ci->dx_max_sort >
+        1.0e-6 * max(fabsf(d), ci->dx_max_sort))
       error("particle shift diff exceeds dx_max_sort.");
   }
   for (int pjd = 0; pjd < cj->count; pjd++) {
@@ -923,7 +924,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) {
     const float d = p->x[0] * runner_shift[sid][0] +
                     p->x[1] * runner_shift[sid][1] +
                     p->x[2] * runner_shift[sid][2];
-    if (fabsf(d - sort_j[pjd].d) - cj->dx_max_sort > 1.0e-6)
+    if (fabsf(d - sort_j[pjd].d) - cj->dx_max_sort >
+        1.0e-6 * max(fabsf(d), ci->dx_max_sort))
       error("particle shift diff exceeds dx_max_sort.");
   }
 #endif /* SWIFT_DEBUG_CHECKS */