Fix bug where some HTTP errors were causing access tokens to invalidate
Cleanup to tests