fix build on DragonFly BSD and FreeBSD