Fix compilation errors for OSX and Free/Open/NetBSD