Mac os x port

Make sure it works on Mac OS X.