fixed a bug in queryEx when exception thrown by consumer.accept()