Fixed distinct queries.