stdClass::$labels /wp-includes/general-template.php undefined

I managed to fix this $labels undefined by writing the following work around. Its custom to how I wanted it to work but it may give others a pointer of how to get it to work for them. It occurs when WordPress could use two types to serve its page and gets confused. Say if the page being served could be an archive page or a tag page (custom of course). Its not sure which way to serve the request and so the title gets knocked. So instead I tell it:

add_action( 'parse_query', 'my_custom_parse_query' );

function my_custom_parse_query( $wp_query ) { 
    global $post_type_obj;

    if ( $wp_query->is_post_type_archive && $wp_query->is_tax ) {

        $term = '';

        if( get_query_var('post_type') == 'my_post_type_1' ){

            $tax1 = get_query_var('custom_tax1');

            $tax2 = get_query_var('custom_tax2');

            $tax3 = get_query_var('custom_tax3');

            if(!empty($tax1)){

                $term = get_term_by( 'slug', $tax1, 'custom_tax1' );

            }else if(!empty($tax2)){

                $term = get_term_by( 'slug', $tax2, 'custom_tax2' );

            }else if(!empty($tax3)){

                $term = get_term_by( 'slug', $tax3, 'custom_tax3' );

            }

            if( !empty($term) ){

                $post_type_obj = get_queried_object();

            if (empty($post_type_obj->labels)) {
                $post_type_obj->labels = new stdClass();
                $post_type_obj->labels->name = $term->name . ' - ' . get_bloginfo('name');
            }

            }

        }else{

            $post_type_obj = get_queried_object();

        if (empty($post_type_obj->labels)) {
            $post_type_obj->labels = new stdClass();
            $post_type_obj->labels->name = $term->name;
        }

        }
    }
}