Fixes

Fixes for clang being good at finding errors and including header freebsd needs.