Compile fixes for FreeBSD