fix some breakage in CMS due to middleware rewrites