better handling of auth failures
Merge pull request #1156 from stolt45/master

better handling of auth failures