Added more validation for hostname