Optimization for differences between Linux and MacOS