added fix for mac os x hostnames which could have ’

or white space in hostname