Fix HostMatcher and add more tests