diff --git a/src/MNH/mode_mnh_zwork.f90 b/src/MNH/mode_mnh_zwork.f90
index b21e9cce1a98f62b199e08077d6310cb8158a5a4..93778335b5756092296f2edb6afb65de95f620f1 100644
--- a/src/MNH/mode_mnh_zwork.f90
+++ b/src/MNH/mode_mnh_zwork.f90
@@ -1,3 +1,12 @@
+#ifdef _OPENACC
+!MNH_LIC Copyright 2013-2019 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
+!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
+!MNH_LIC for details. version 1.
+!-----------------------------------------------------------------
+! Modifications:
+!  P. Wautelet 10/07/2019: bugfix: MNH_REL_ZT3D_N0: access outside of array was possible
+!-----------------------------------------------------------------
 MODULE MODE_MNH_ZWORK
 
   use mode_msg
@@ -213,13 +222,14 @@ CONTAINS
     IF ( ( NT3D_TOP > JPMAX_T3D ) .OR. ( NT3D_TOP < 1 ) ) THEN
       call Print_msg( NVERB_FATAL, 'GEN', 'MNH_REL_ZT3D_N0', 'invalid value for NT3D_TOP' )
     ELSE
-       NT3D_POOL(KTEMP) = KTEMP
-       IF (KTEMP == NT3D_TOP) THEN
-         NT3D_TOP = NT3D_TOP - 1
-         DO WHILE (NT3D_TOP > 0 .AND. NT3D_POOL(NT3D_TOP) /= -1 )
-           NT3D_TOP = NT3D_TOP - 1
-         END DO
-       END IF
+      NT3D_POOL(KTEMP) = KTEMP
+      IF (KTEMP == NT3D_TOP) THEN
+        NT3D_TOP = NT3D_TOP - 1
+        DO WHILE (NT3D_TOP > 0 )
+          if ( NT3D_POOL(NT3D_TOP) == -1 ) exit
+          NT3D_TOP = NT3D_TOP - 1
+        END DO
+      END IF
     ENDIF
     !WRITE( *, '( "MNH_REL_ZT3D: releasing ZT3D (",I4,")" )' ) KTEMP
 
@@ -290,3 +300,4 @@ CONTAINS
 
 
 END MODULE MODE_MNH_ZWORK
+#endif