Fix some issues on FreeBSD.