Bugfixes for MacOS