Fix TOS stuff for BSD