Fix for async query composition issue. Some other minor improvements to ...

...query framework