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