Fixed build on FreeBSD and Win32