Changes to get it to build on FreeBSD