some fixes from OS X