fix bad host or port

this fix the class and report false if a bad host or port