small optimization for loop