Fixes for OpenBSD compilation. Fixes #826, as suggested by pstumpf.