Changes for compatibility with MacOS