fixed history query