Fix a few osx/bsd compile bugs
recreate for-w branch in C++
Fix dup sends