fix some embedded policy cases, add some tests