Fix bad task host selection

It looks like #873 has broken the test battery where the tests concern
bad task hosts.
Merge pull request #875 from matthewrmshin/fix-bad-task-host

Fix bad task host selection