Fix ba script.

* search url requires a slash or we get a 301
* links to state and country changed
* add nullsafe references to regex matches to make things a little more robust