Added more logging and debug
Also safely set socket.host
Merge pull request #132 from RWOverdijk/hotfix/more-logging

Added more logging and debug