added check for corrected queries or 404 pages