fixing trips query