fixing a Mac crash bug