fix FreeBSD compilation

Tested on FreeBSD-9.1 x86_64