handle json response on global 404 and error handler

rt