Debug mode conditions; Proper user-agent
Merge pull request #2 from duhast/master

Debug mode switch to prevent IO error