diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp
index 4d80a4ebb931640b04c072788bdc5c0616559260..418781f75b669cc3cfe9c9ac6d6705ebe80fafb7 100644
--- a/source/Lib/EncoderLib/EncLib.cpp
+++ b/source/Lib/EncoderLib/EncLib.cpp
@@ -119,7 +119,7 @@ void EncLib::create( const int layerId )
       {
         int refLayerChromaFormatIdcInVPS = vps->getLayerChromaFormatIDC(i);
         CHECK(curLayerChromaFormatIdcInVPS != refLayerChromaFormatIdcInVPS, "The chroma formats of the current layer and the reference layer are different");
-        int refLayerBitDepthInVPS = vps->getLayerBitDepth(layerId);
+        int refLayerBitDepthInVPS = vps->getLayerBitDepth(i);
         CHECK(curLayerBitDepthInVPS != refLayerBitDepthInVPS, "The bit-depth of the current layer and the reference layer are different");
       }
     }