dns: fix error handling