fix query histories