Fix segmentation fault on NetBSD