bug fix db/query