fix not using smaller gram sizes after larger ones have failed