diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
index fd7bf509740c1311b6bd1ccf2baace47c1226775..4337a8d8fb50d8563e5e59d454a66ea618d713b7 100644
--- a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
+++ b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90
@@ -1629,7 +1629,7 @@ END DO
       END IF
       IF (TRIM(TPREC%TDIMS(JJ)%cname)/='time' .AND. &
         TPREC%TDIMS(JJ)%nlen /= TPREC%NDIMSIZES_FILE(JJ)) THEN
-        CALL PRINT_MSG(NVERB_WARNING,'IO','IO_FILL_DIMS_NC4','problem with dimensions for '//TPREC%TFIELD%CMNHNAME)
+        CALL PRINT_MSG(NVERB_WARNING,'IO','IO_Dims_fill_nc4','problem with dimensions for '//TPREC%TFIELD%CMNHNAME)
         KRESP = -3
         EXIT
       END IF
diff --git a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
index ecd39b6fd51ae887ff319b7963d4775ca79f8ed6..29317bc5e5e81149bd08dc6c5afe3d93212e8302 100644
--- a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90
@@ -44,7 +44,6 @@ character(len=*), intent(in)  :: hdimname
 type(tdimnc),     intent(out) :: tpdim
 integer,          intent(out) :: kresp
 
-integer :: idx
 integer :: ji
 
 call Print_msg( NVERB_DEBUG, 'IO', 'IO_Dim_find_byname_nc4', 'called for dimension name ' // Trim( hdimname ) )
@@ -63,10 +62,9 @@ if ( .not.Allocated( tpfile%tncdims%tdims ) ) then
   return
 end if
 
-idx = -1
 do ji = 1, tpfile%tncdims%nmaxdims
   if ( Trim( hdimname ) == Trim( tpfile%tncdims%tdims(ji)%cname ) ) then
-    idx = ji
+    tpdim = tpfile%tncdims%tdims(ji)
     kresp = 0
     exit
   end if