Fixed minor portability issues to support FreeBSD.