lazy catching of 404s and rendering of json instead of html error page