FreeBSD compatibility.
Merge pull request #574 from yurivict/compatibility_FreeBSD

FreeBSD compatibility