Portability fixes for FreeBSD - include the right headers.