OSX exit crash fix