add detect-server function
cosmetic change