Added suitable catch of exception in hostname resolving section.