Fix compile error on FreeBSD (patch by Ricardo Buring)