Locations geocoding to province, not country
The problem is not actually with that snippet of code in _google_geocode_flatten(), but is just a result of google's geocoding algorithms.

For example, your search for BB finds 2 results, Brandenburg Germany &amp; Barbados, however google puts the former as the first result, possibly due to popularity of searches or something.

See http://maps.googleapis.com/maps/api/geocode/json?address=bb&amp;region=bb&amp;sensor=false

The solution I can see is to also pass in the component param when requesting from google geocoder, which allows you to specify specific parts of the address in addition to the full address string.

See https://developers.google.com/maps/documentation/geocoding/#ComponentFiltering

I have posted a patch back to your issue on drupal.org