r141: A number of changes to get things working on FreeBSD and reduce the breakage