fix a few errors on FreeBSD