Close #819 - remove trailing . from hostname if it exists