Logic fix for query splitting.