multi query bug fix