Fixes for FreeBSD 9