query bug fix and option params