FreeBSD support and clean up of unnecessary ifdef FREEBSD