Correcting some bugs on FreeBSD