Improve OS X support