Fixed compilation for FreeBSD and Ubuntu