Fixed build so works on FreeBSD