made hostname truncation less brittle