Fix for FreeBSD and Solaris