Fix for FreeBSD, and remove support for older FreeBSD versions. Patch by Pietro Cerutti.