Cherrypicked 2c225 and b82fd, syscheck stuff