fix bsd build problems