fixed main query