Resolve bugs in freebsd implementation
Merge branch 'freebsd-support' into lightspeed