Macosx build improvements