diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90
index 2697068cb223f701fb06b4803e59f1766ad10be0..028b375183b6d3bddd7d07b7d0c5aadd0e67fd70 100644
--- a/Overlap/eddy_graph.f90
+++ b/Overlap/eddy_graph.f90
@@ -93,7 +93,7 @@ program eddy_graph
      copy = merge(dist_lim, 0, periodic)
      call read_column(ishape_last, &
           file = trim(shpc_dir) // "/ishape_last.txt", last = n_dates)
-     n_dates = size(ishape_last)
+     if (n_dates == huge(0)) n_dates = size(ishape_last)
      call assert(n_dates >= max_delta + 1, &
           "eddy_graph: n_dates should be >= max_delta + 1")
      call assert(n_proc <= n_dates / (max_delta + 1), &