fixes for build on freeBSD