correct crashing bug on Mac