fixes issue with trying to add null hosts. Thanks @ThomasConstans