Fix FreeBSD issues