Fix bugs of BDQuery