Fix MacOS runtime error