fixes for compiling on FreeBSD