Fixes for FreeBSD