Adding is_main_query check.