patch to fix run on Mac (and more)