add custom middleware to handle 404 situations