fixed error: now using hostname instead of mdata-get because mdata-get fails if no hostname is set in mdata