fix share count in case of api error

If an API throws an error, the share count will be omitted in the
backend response.