Mac Os X

Several fixes to max unknown horizons ready for Mac Os X. Please review this patches carefully.