Improve OSX compatibility