Added patches from FreeBSD ports.