Compatibility improvements for BSD.