Fixed bug that resulted in selecting too many hits for queries with x>number_unique_gids.