diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 1cc4fada171c288309728bf7acb884cee00f56a3..fabd1b69ec71ea29c619a988877073870ec10853 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -932,15 +932,17 @@ void HLSyntaxReader::parseAPS( APS* aps )
   aps->chromaPresentFlag = codeApsChromaPresentFlag;
 #endif
 
-  if( code == ALF_APS )
+  const ApsType apsType = aps->getAPSType();
+
+  if (apsType == ALF_APS)
   {
     parseAlfAps( aps );
   }
-  else if( code == LMCS_APS )
+  else if (apsType == LMCS_APS)
   {
     parseLmcsAps( aps );
   }
-  else if( code == SCALING_LIST_APS )
+  else if (apsType == SCALING_LIST_APS)
   {
     parseScalingListAps( aps );
   }