Fixed CBQuery for empty queries