fix saving permissions