hostname attribute issue & indentation

Better fix for hostname attribute issue, and some indentation fixes.
Merge pull request #4 from lingfish/master

hostname attribute issue & indentation