Fix crash on Mac