Looks to me the problem is in the hostname identification...
First of all can you do
Please also provide the results. "The one word answers doesn't help us". Give us the result output as it is....
Life is a journey, not a destination!