Bug with Simple Ads - Main Blog assumed to be blog id = 1

In simple-ads.php there is a hard coded reference to blog id 1 which is assumed to be the main blog:
if ( $wpdb->blogid == 1 && $advertising_main_blog == 'hide' ) {
$display_ads = 'no';

In my installation, this isn't the case. I am using a subdomain install where blog id=1 is mydomain.com and blog id=3 = http://www.mydomain.tld

In wp-config.php I have
define ( 'BP_ROOT_BLOG', 3 )
define('DOMAIN_CURRENT_SITE','www.mydomain.tld');

Is there a PHP WP library call to get the root blog id and use this in simple-ads.php instead of the hardcoded value?

Thanks,

Scott

[Links edited ~ drmike]