fixing up 'prior queries' extraction script