Finally fixed the loop