fix crash on Mac