Fix errors with HTTPError and refresh