fix for FreeBSD and OSX