Fixed cast for FreeBSD.