diff --git a/src/compute_Sapj.F90 b/src/compute_Sapj.F90
index 81fc11f3de2db90a274a7eb9f019beb7f87515d4..4ef4f87d92ce026335a723accff7703344c000ee 100644
--- a/src/compute_Sapj.F90
+++ b/src/compute_Sapj.F90
@@ -128,9 +128,9 @@ SUBROUTINE compute_Sapj
 
       ! Set non linear sum truncation
       IF (NL_CLOS .EQ. -2) THEN
-        nmax = Jmaxe
+        nmax = Jmaxi
       ELSEIF (NL_CLOS .EQ. -1) THEN
-        nmax = Jmaxe-(ij-1)
+        nmax = Jmaxi-(ij-1)
       ELSE
         nmax = NL_CLOS
       ENDIF
@@ -150,7 +150,7 @@ SUBROUTINE compute_Sapj
             Gz_cmpx(ikr,ikz) = 0._dp ! initialization of the sum
             Gr_cmpx(ikr,ikz) = 0._dp ! initialization of the sum
 
-            smax = MIN( (in-1)+(ij-1), jmaxe );
+            smax = MIN( (in-1)+(ij-1), jmaxi );
             DO is = 1, smax+1 ! sum truncation on number of moments
               Gz_cmpx(ikr,ikz) = Gz_cmpx(ikr,ikz) + &
                 dnjs(in,ij,is) * moments_i(ip,is,ikr,ikz,updatetlevel)