Fix id queries