Refactor. Fixed host matching algorithm type check issue