set proxy outside the loop