Fixed compilation errors on OSX