fix the loop in the update script