check_dns: returns incorrect state when specifying server

Just turned patch from github issue #981 into a pull request which fixes
gihub issue 982