Tweaks to make this work on Mac OS X too.