fix bugs in highstate whitelist, add tests