adding freebsd compatibility patch by aXon to master