fixed for loop limit