Fix support for bsd.