Added debugging of query.