Fix segv.
Merge remote-tracking branch 'upstream/master'
Freebsd build fixes.
Merge pull request #81 from trasz/master

Fix segv.