Mac OS X fixes. note: replace the src/CGFapplication.cpp:255 with something more reliable!