macosx port - merge windows and macosx/linux changes