Add support for host masks, fix broken component sorting