fix for 400 bad request being thrown on Unauthorized