diff --git a/source/App/CabacTraining/optimization.h b/source/App/CabacTraining/optimization.h
index b00cf087ae550a45239be61efbad88a0fb465d71..4399bc35f6cdb968c1240309f167ba6d7ad7c7a5 100644
--- a/source/App/CabacTraining/optimization.h
+++ b/source/App/CabacTraining/optimization.h
@@ -25,7 +25,7 @@ inline ModelParameters getBestGreedy( const DataDb &db, SliceType st )
     {
       for( int winSizesIdx = winSizesIdxStart; winSizesIdx <= winSizesIdxEnd; ++winSizesIdx )
       {
-        for( int weightIdx = weightIdxStart; weightIdx < weightIdxEnd; ++weightIdx )
+        for( int weightIdx = weightIdxStart; weightIdx <= weightIdxEnd; ++weightIdx )
         {
           prm.initId = (slope << 3) | (offset);
           prm.log2windowsize = log2winsize[winSizesIdx];