fix bugs for mac