Fixed FreeBSD related issues