Fixed compatibility issues with Mac