query execution bug fix