small performance optimization to for loop

little tweak to make for loop faster