Fixed asynchronous nature of for loop