patch from Christian for FreeBSD