Fixing the loop