Added exception handling for URLError