osx/linux build compatibility fixes