fixed query error on page load