added 404 error code handling