Fixes malformed response issue in api errors.