Fixed build system for BSD support