adapt to Mac and Linux