FreeBSD compatibility fixes.