added support for processing 401, auth failures