rework patches during sync with FreeBSD