Index: branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90
===================================================================
--- branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 6986)
+++ branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/DYN/wet_dry.F90	(revision 6995)
@@ -146,6 +146,6 @@
         ! Horizontal Flux in u and v direction
         DO jk = 1, jpkm1  
-           DO jj = 1, jpjm1
-              DO ji = 1, jpim1
+           DO jj = 1, jpj
+              DO ji = 1, jpi
                  zflxu(ji,jj) = zflxu(ji,jj) + e3u_n(ji,jj,jk) * un(ji,jj,jk) * umask(ji,jj,jk)
                  zflxv(ji,jj) = zflxv(ji,jj) + e3v_n(ji,jj,jk) * vn(ji,jj,jk) * vmask(ji,jj,jk)
@@ -158,6 +158,6 @@
        
         wdmask(:,:) = 1
-        DO jj = 2, jpjm1
-           DO ji = 2, jpim1 
+        DO jj = 2, jpj
+           DO ji = 2, jpi 
 
              IF(tmask(ji, jj, 1) < 0.5_wp) CYCLE   ! we don't care about land cells
@@ -186,6 +186,6 @@
            zflxv1(:,:) = zflxv(:,:) * zwdlmtv(:,:)
           
-           DO jj = 2, jpjm1
-              DO ji = 2, jpim1 
+           DO jj = 2, jpj
+              DO ji = 2, jpi 
         
                  IF(tmask(ji, jj, 1) < 0.5_wp) CYCLE 
Index: branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_fct.F90
===================================================================
--- branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_fct.F90	(revision 6986)
+++ branches/2016/dev_r6393_NOC_WAD/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_fct.F90	(revision 6995)
@@ -149,12 +149,11 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
-                  ! total intermediate advective trends
+                  !                             ! total intermediate advective trends
                   ztra = - (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
                      &      + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
-                     &      + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) ) * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk)
-                  ! update and guess with monotonic sheme
-!!gm why tmask added in the two following lines ???    the mask is done in tranxt !
-                  pta(ji,jj,jk,jn) =   pta(ji,jj,jk,jn)         + ztra   * tmask(ji,jj,jk)
-                  zwi(ji,jj,jk)    = ( ptb(ji,jj,jk,jn) + p2dt * ztra ) * tmask(ji,jj,jk)
+                     &      + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) ) * r1_e1e2t(ji,jj)
+                  !                             ! update and guess with monotonic sheme
+                  pta(ji,jj,jk,jn) =                     pta(ji,jj,jk,jn) +        ztra   / e3t_n(ji,jj,jk) * tmask(ji,jj,jk)
+                  zwi(ji,jj,jk)    = ( e3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + p2dt * ztra ) / e3t_a(ji,jj,jk) * tmask(ji,jj,jk)
                END DO
             END DO
@@ -163,5 +162,5 @@
          !                
          IF( l_trd )  THEN             ! trend diagnostics (contribution of upstream fluxes)
-            ztrdx(:,:,:) = zwx(:,:,:)   ;    ztrdy(:,:,:) = zwy(:,:,:)  ;   ztrdz(:,:,:) = zwz(:,:,:)
+            ztrdx(:,:,:) = zwx(:,:,:)   ;   ztrdy(:,:,:) = zwy(:,:,:)   ;   ztrdz(:,:,:) = zwz(:,:,:)
          END IF
          !                             ! "Poleward" heat and salt transports (contribution of upstream fluxes)
@@ -364,5 +363,5 @@
       !
       CALL wrk_alloc( jpi,jpj,             zwx_sav, zwy_sav )
-      CALL wrk_alloc( jpi,jpj, jpk,        zwx, zwy, zwz, zwi, zhdiv, zwzts, zwz_sav )
+      CALL wrk_alloc( jpi,jpj,jpk,         zwx, zwy, zwz, zwi, zhdiv, zwzts, zwz_sav )
       CALL wrk_alloc( jpi,jpj,jpk,kjpt+1,  ztrs )
       !
@@ -436,8 +435,8 @@
                   ztra = - (  zwx(ji,jj,jk) - zwx(ji-1,jj  ,jk  )   &
                      &      + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
-                     &      + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1)   ) * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk)
+                     &      + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1)   ) * r1_e1e2t(ji,jj)
                   !                             ! update and guess with monotonic sheme
-                  pta(ji,jj,jk,jn) =   pta(ji,jj,jk,jn)         + ztra
-                  zwi(ji,jj,jk)    = ( ptb(ji,jj,jk,jn) + p2dt * ztra ) * tmask(ji,jj,jk)
+                  pta(ji,jj,jk,jn) =                     pta(ji,jj,jk,jn) +        ztra   / e3t_n(ji,jj,jk) * tmask(ji,jj,jk)
+                  zwi(ji,jj,jk)    = ( e3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + p2dt * ztra ) / e3t_a(ji,jj,jk) * tmask(ji,jj,jk)
                END DO
             END DO
@@ -488,4 +487,6 @@
          zwz_sav(:,:,:)   = zwz(:,:,:)
          ztrs   (:,:,:,1) = ptb(:,:,:,jn)
+         ztrs   (:,:,1,2) = ptb(:,:,1,jn)
+         ztrs   (:,:,1,3) = ptb(:,:,1,jn)
          zwzts  (:,:,:)   = 0._wp
          !
