cleanup advanced query on page load