FreeBSD fixes

These are required to build tox on FreeBSD, and will likely be useful on other systems