Wip/darwin support

fixes for preliminary macosx-10.6 support