Get rid of the !FreeBSD case, and add some fixes from Adam Leventhal.