diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index c9643a0efa39372cff848e7a7ca83b7aab002405..fea13ec347a209571ac2e092f1f591b50f50f3ce 100755
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -3809,6 +3809,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
     {
       int        blkPos         = cctx.blockPos( scanPos );
       sigBlkPos[ numNonZero++ ] = blkPos;
+      firstNZPos = nextSigPos;
       lastNZPos  = std::max<int>( lastNZPos, scanPos );
       coeff[blkPos] = tcoeff;
     }
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index d6b0d3ad2cf356cb0f4350f59dec0012b92f81a9..1675bafc7632b7c823b8bd11cfc7c824a2c0d291 100755
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -3627,6 +3627,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
     if( absLevel )
     {
       numNonZero++;
+      firstNZPos = nextSigPos;
       lastNZPos   = std::max<int>( lastNZPos, scanPos );
       signPattern <<= 1;
       if( Coeff < 0 ) signPattern++;