agent: Fixes needed to run on FreeBSD