diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp
index 0664d3ae..31cf246b 100644
--- a/source/Lib/CommonLib/IntraPrediction.cpp
+++ b/source/Lib/CommonLib/IntraPrediction.cpp
@@ -3849,7 +3849,11 @@ bool IntraPrediction::isRefTemplateAvailable(CodingUnit& cu, CompArea& area)
   {
     return L_SHAPE_TEMPLATE;
   }
+#if JVET_AD0239_FIX1
+  else if (isLeftAvailable(cu, chType, posLT, numLeftUnits, unitHeight, (neighborFlags + totalLeftUnits - 1)))
+#else
   else if (isAboveLeftAvailable(cu, chType, posLT))
+#endif
   {
     return LEFT_TEMPLATE;
   }
@@ -9981,7 +9985,11 @@ void insertNode( int diff, int& iXOffset, int& iYOffset, int& pDiff, int& pX, in
   pId = setId;
 }
 
+#if JVET_AD0239_FIX2
+void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& iHorMax, int& iVerMin, int& iVerMax, unsigned int uiTemplateSize, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int iCurrY, int iCurrX, int offsetLCUY, int offsetLCUX, RefTemplateType tempType )
+#else
 void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& iHorMax, int& iVerMin, int& iVerMax, unsigned int uiTemplateSize, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int iCurrY, int iCurrX, int offsetLCUY, int offsetLCUX )
+#endif
 {
   int searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR * uiBlkWidth;
   int searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR * uiBlkHeight;
@@ -9991,11 +9999,19 @@ void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& i
   int iBlkHeight = uiBlkHeight;
   if( regionId == 0 ) //above outside LCU
   {
+#if JVET_AD0239_FIX2
+    iHorMax = std::min( (iCurrX + searchRangeWidth) << iMvShift, ( int ) ((pcCU->cs->pps->getPicWidthInLumaSamples() - iBlkWidth) << iMvShift) );
+    iHorMin = std::max( (tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift);
+
+    iVerMax = (iCurrY - iBlkHeight - offsetLCUY) << iMvShift;
+    iVerMin = std::max( (tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, ((iCurrY - searchRangeHeight) << iMvShift) );
+#else
     iHorMax = std::min( (iCurrX + searchRangeWidth) << iMvShift, ( int ) ((pcCU->cs->pps->getPicWidthInLumaSamples() - iBlkWidth) << iMvShift) );
     iHorMin = std::max( (iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift );
 
     iVerMax = (iCurrY - iBlkHeight - offsetLCUY) << iMvShift;
     iVerMin = std::max( ((iTemplateSize) << iMvShift), ((iCurrY - searchRangeHeight) << iMvShift) );
+#endif
 
     iHorMin = iHorMin - iCurrX;
     iHorMax = iHorMax - iCurrX;
@@ -10004,11 +10020,19 @@ void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& i
   }
   else if( regionId == 1 ) //left outside LCU
   {
+#if JVET_AD0239_FIX2
+    iHorMax = (iCurrX - offsetLCUX - iBlkWidth) << iMvShift;
+    iHorMin = std::max( (tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift );
+
+    iVerMin = std::max( (tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrY - iBlkHeight - offsetLCUY) << iMvShift );
+    iVerMax = (iCurrY) << iMvShift;
+#else
     iHorMax = (iCurrX - offsetLCUX - iBlkWidth) << iMvShift;
     iHorMin = std::max( (iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift );
 
     iVerMin = std::max( (iTemplateSize) << iMvShift, (iCurrY - iBlkHeight - offsetLCUY) << iMvShift );
     iVerMax = (iCurrY) << iMvShift;
+#endif
 
     iHorMin = iHorMin - iCurrX;
     iHorMax = iHorMax - iCurrX;
@@ -10017,7 +10041,11 @@ void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& i
   }
   else if( regionId == 2 ) //left outside LCU (can reach the bottom row of LCU)
   {
+#if JVET_AD0239_FIX2
+    iHorMin = std::max( (tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift );
+#else
     iHorMin = std::max( (iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift );
+#endif
     iHorMax = (iCurrX - offsetLCUX - iBlkWidth) << iMvShift;
     iVerMin = (iCurrY + 1) << iMvShift;
     iVerMax = std::min( pcCU->cs->pps->getPicHeightInLumaSamples() - iBlkHeight, (iCurrY - offsetLCUY + pcCU->cs->sps->getCTUSize() - iBlkHeight) << iMvShift );
@@ -10030,7 +10058,11 @@ void clipMvIntraConstraint( CodingUnit* pcCU, int regionId, int& iHorMin, int& i
 }
 
 #if JVET_AB0130_ITMP_SAMPLING
+#if JVET_AD0239_FIX2
+void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin, int& iHorMax, int& iVerMin, int& iVerMax, unsigned int uiTemplateSize, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int iCurrY, int iCurrX, int offsetLCUY, int offsetLCUX, int pX, int pY, int RefinementRange, RefTemplateType tempType)
+#else
 void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin, int& iHorMax, int& iVerMin, int& iVerMax, unsigned int uiTemplateSize, unsigned int uiBlkWidth, unsigned int uiBlkHeight, int iCurrY, int iCurrX, int offsetLCUY, int offsetLCUX, int pX, int pY, int RefinementRange)
+#endif
 {
   int searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR * uiBlkWidth;
   int searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR * uiBlkHeight;
@@ -10040,10 +10072,17 @@ void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin,
   int iBlkHeight = uiBlkHeight;
   if (regionId == 0) //above outside LCU
   {
+#if JVET_AD0239_FIX2
+    iHorMax = std::min((iCurrX + searchRangeWidth) << iMvShift, (int)((pcCU->cs->pps->getPicWidthInLumaSamples() - iBlkWidth) << iMvShift));
+    iHorMin = std::max((tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift);
+    iVerMax = (iCurrY - iBlkHeight - offsetLCUY) << iMvShift;
+    iVerMin = std::max((tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, ((iCurrY - searchRangeHeight) << iMvShift));
+#else
     iHorMax = std::min((iCurrX + searchRangeWidth) << iMvShift, (int)((pcCU->cs->pps->getPicWidthInLumaSamples() - iBlkWidth) << iMvShift));
     iHorMin = std::max((iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift);
     iVerMax = (iCurrY - iBlkHeight - offsetLCUY) << iMvShift;
     iVerMin = std::max(((iTemplateSize) << iMvShift), ((iCurrY - searchRangeHeight) << iMvShift));
+#endif
     int BestPosX = iCurrX + pX;
     int BestPosY = iCurrY + pY;
     iHorMin = std::max(iHorMin, BestPosX - RefinementRange);
@@ -10059,8 +10098,13 @@ void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin,
   else if (regionId == 1) //left outside LCU
   {
     iHorMax = (iCurrX - offsetLCUX - iBlkWidth) << iMvShift;
+#if JVET_AD0239_FIX2
+    iHorMin = std::max((tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift);
+    iVerMin = std::max((tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrY - iBlkHeight - offsetLCUY) << iMvShift);
+#else
     iHorMin = std::max((iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift);
     iVerMin = std::max((iTemplateSize) << iMvShift, (iCurrY - iBlkHeight - offsetLCUY) << iMvShift);
+#endif
     iVerMax = (iCurrY) << iMvShift;
     int BestPosX = iCurrX + pX;
     int BestPosY = iCurrY + pY;
@@ -10075,7 +10119,11 @@ void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin,
   }
   else if (regionId == 2) //left outside LCU (can reach the bottom row of LCU)
   {
+#if JVET_AD0239_FIX2
+    iHorMin = std::max((tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - searchRangeWidth) << iMvShift);
+#else
     iHorMin = std::max((iTemplateSize) << iMvShift, (iCurrX - searchRangeWidth) << iMvShift);
+#endif
     iHorMax = (iCurrX - offsetLCUX - iBlkWidth) << iMvShift;
     iVerMin = (iCurrY + 1) << iMvShift;
     iVerMax = std::min(pcCU->cs->pps->getPicHeightInLumaSamples() - iBlkHeight, (iCurrY - offsetLCUY + pcCU->cs->sps->getCTUSize() - iBlkHeight) << iMvShift);
@@ -10092,10 +10140,17 @@ void clipMvIntraConstraint_Refine(CodingUnit* pcCU, int regionId, int& iHorMin,
   }
   else if (regionId == 3) // within CTU
   {
+#if JVET_AD0239_FIX2
+    iVerMin = std::max((tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrY - offsetLCUY - iBlkHeight + 1) << iMvShift);
+    iVerMax = (iCurrY - iBlkHeight) << iMvShift;
+    iHorMin = std::max((tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - offsetLCUX - iBlkWidth + 1) << iMvShift);
+    iHorMax = (iCurrX - iBlkWidth) << iMvShift;
+#else
     iVerMin = std::max(((iTemplateSize) << iMvShift), (iCurrY - offsetLCUY - iBlkHeight + 1) << iMvShift);
     iVerMax = (iCurrY - iBlkHeight) << iMvShift;
     iHorMin = std::max((iTemplateSize) << iMvShift, (iCurrX - offsetLCUX - iBlkWidth + 1) << iMvShift);
     iHorMax = (iCurrX - iBlkWidth);
+#endif
     int BestPosX = iCurrX + pX;
     int BestPosY = iCurrY + pY;
     iHorMin = std::max(iHorMin, BestPosX - RefinementRange);
@@ -10305,10 +10360,17 @@ void IntraPrediction::searchCandidateFromOnePicIntra( CodingUnit* pcCU, Pel** ta
   regionId = 0;
   int iMvShift = 0;
 
+#if JVET_AD0239_FIX2
+  int iVerMin = std::max( (tempType != LEFT_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrY - offsetLCUY - iBlkHeight + 1) << iMvShift );
+  int iVerMax = (iCurrY - iBlkHeight) << iMvShift;
+  int iHorMin = std::max( (tempType != ABOVE_TEMPLATE) ? iTemplateSize << iMvShift : 0, (iCurrX - offsetLCUX - iBlkWidth + 1) << iMvShift );
+  int iHorMax = (iCurrX - iBlkWidth) << iMvShift;
+#else
   int iVerMin = std::max( ((iTemplateSize) << iMvShift), (iCurrY - offsetLCUY - iBlkHeight + 1) << iMvShift );
   int iVerMax = (iCurrY - iBlkHeight) << iMvShift;
   int iHorMin = std::max( (iTemplateSize) << iMvShift, (iCurrX - offsetLCUX - iBlkWidth + 1) << iMvShift );
   int iHorMax = (iCurrX - iBlkWidth);
+#endif
 
   mvXMins[regionId] = iHorMin - iCurrX;
   mvXMaxs[regionId] = iHorMax - iCurrX;
@@ -10362,7 +10424,11 @@ void IntraPrediction::searchCandidateFromOnePicIntra( CodingUnit* pcCU, Pel** ta
   for( regionId = 0; regionId < regionNum; regionId++ )
   {
     // this function fills in the range the template matching for pixels outside the current CTU
+#if JVET_AD0239_FIX2
+    clipMvIntraConstraint( pcCU, regionId, mvXMins[regionId], mvXMaxs[regionId], mvYMins[regionId], mvYMaxs[regionId], TMP_TEMPLATE_SIZE, uiBlkWidth, uiBlkHeight, iCurrY, iCurrX, offsetLCUY, offsetLCUX, tempType );
+#else
     clipMvIntraConstraint( pcCU, regionId, mvXMins[regionId], mvXMaxs[regionId], mvYMins[regionId], mvYMaxs[regionId], TMP_TEMPLATE_SIZE, uiBlkWidth, uiBlkHeight, iCurrY, iCurrX, offsetLCUY, offsetLCUX );
+#endif
   }
 
   for( regionId = 0; regionId < regionNum; regionId++ )
@@ -10417,7 +10483,11 @@ void IntraPrediction::searchCandidateFromOnePicIntra( CodingUnit* pcCU, Pel** ta
     {
       int iRefine = 1 << iRefineLog2;
       int tmpRefineRange = std::min(uiBlkHeight, uiBlkHeight) / 2;
+#if JVET_AD0239_FIX2
+      clipMvIntraConstraint_Refine(pcCU, bestRegionId, mvXMins[bestRegionId], mvXMaxs[bestRegionId], mvYMins[bestRegionId], mvYMaxs[bestRegionId], TMP_TEMPLATE_SIZE, uiBlkWidth, uiBlkHeight, iCurrY, iCurrX, offsetLCUY, offsetLCUX, pX, pY, iRefine * tmpRefineRange, tempType);
+#else
       clipMvIntraConstraint_Refine(pcCU, bestRegionId, mvXMins[bestRegionId], mvXMaxs[bestRegionId], mvYMins[bestRegionId], mvYMaxs[bestRegionId], TMP_TEMPLATE_SIZE, uiBlkWidth, uiBlkHeight, iCurrY, iCurrX, offsetLCUY, offsetLCUX, pX, pY, iRefine * tmpRefineRange);
+#endif
       int mvYMin = mvYMins[bestRegionId];
       int mvYMax = mvYMaxs[bestRegionId];
       int mvXMin = mvXMins[bestRegionId];
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 6a53b54c..892661b5 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -129,6 +129,10 @@
 #define TMP_FAST_ENC                                      1 // Encoder-only modification
 #endif
 #define JVET_W0069_TMP_BOUNDARY                           1 // JVET-W0069: Boundary handling for TMP
+#if JVET_W0069_TMP_BOUNDARY
+#define JVET_AD0239_FIX1                                  1 // JVET-AD0239: Fix left template availability for the current block
+#define JVET_AD0239_FIX2                                  1 // JVET-AD0239: Fix reference block search zone for left and above templates
+#endif
 #define JVET_AB0061_ITMP_BV_FOR_IBC                       1 // JVET-AB0061: Storing IntraTMP BV for IBC BV prediction
 #endif
 
