fixed various OS X and Windows build issues