update_blog_option() and caching problem

I am trying to write a simple script to loop through all blog ids and update a blog option. I’ve done this many times before with no problem, but this time I am having some weird caching issue or something that is breaking it.

Here’s the code:

global $wpdb, $site_id;

$query = "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = $site_id AND blog_id != 1";

$blog_list = $wpdb->get_results( $query, ARRAY_A );

$count = 0;

foreach ( (array) $blog_list as $blog) {

update_blog_option( $blog, 'users_can_register', 1 );

update_blog_option( $blog, 'default_role', $_POST );

$count++;

}

Every time the bold line is run, it adds a new identical option to the db instead of updating the old one (with an incremented id). Any other update_blog_option call works as expected in this loop.

The only thing I can thing is that option is screwed up in my cache. How do I clear it?