update 404 and 500 to return json