little changes to work with freebsd9

Hi blt04,

I made some changes to get it working with freebsd 9. Maybe you could use some of the changes to include freebsd compatibility.

Cheers,
herrBeesch