Fixing check_page_for_errors function