Improve hostname processing.