diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp
index 3a2f07ee1c3ae60e62c585bc93a541d5b4a79749..a0ea00203e4f3d74e956c2bed7b9c39e88cb0bbf 100644
--- a/source/Lib/CommonLib/Slice.cpp
+++ b/source/Lib/CommonLib/Slice.cpp
@@ -658,7 +658,7 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi
   {
     if (pRPL0->isInterLayerRefPic(i))
     {
-      int refLayerId = m_pcPic->cs->vps->getLayerId(m_pcPic->cs->vps->getDirectRefLayerIdx(layerIdx, m_pRPL0->getInterLayerRefPicIdx(i)));
+      int refLayerId = m_pcPic->cs->vps->getLayerId(m_pcPic->cs->vps->getDirectRefLayerIdx(layerIdx, pRPL0->getInterLayerRefPicIdx(i)));
       pcRefPic = xGetRefPic(rcListPic, getPOC(), refLayerId);
       refPicPOC = pcRefPic->getPOC();
     }
@@ -717,7 +717,7 @@ void Slice::checkRPL(const ReferencePictureList* pRPL0, const ReferencePictureLi
   {
     if (pRPL1->isInterLayerRefPic(i))
     {
-      int refLayerId = m_pcPic->cs->vps->getLayerId(m_pcPic->cs->vps->getDirectRefLayerIdx(layerIdx, m_pRPL1->getInterLayerRefPicIdx(i)));
+      int refLayerId = m_pcPic->cs->vps->getLayerId(m_pcPic->cs->vps->getDirectRefLayerIdx(layerIdx, pRPL1->getInterLayerRefPicIdx(i)));
       pcRefPic = xGetRefPic(rcListPic, getPOC(), refLayerId);
       refPicPOC = pcRefPic->getPOC();
     }