Various fix for Max OS X