wp_insert_post and custom taxonomy

Well I found the answer. The code is correct.
Wordpress do in taxonomy.php Line 3392

    $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status="publish" AND post_type IN ('" . implode("', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) );

$count is empty because post_status=”publish” in WHERE statement and my post are saved as draft.

I think so that´s the reason why the counter are empty on second image.