improved permission mw and made js work