Removed a TODO remark and some debug logging.
Fixed the problem related to upstream queries, now all supporte queries should work.