Fix bug when API error is a string