Added rescue for socket error when trying to guess hostname closing #513