Mac OS compatibility fixes