updated to be much closer to NetBSD version