fix incorrect optimized index count