make localhost the default for the server
a variety of changes to robustify this