Fix library loading on FreeBSD systems