Fixed the loop