Missing includes on FreeBSD

Besides some cosmetic stuff, this pull request fixes building on FreeBSD