modified for OpenBSD