Some fixes for mac