Freensd fix

Added mempcpy, freebsd compatibility.