fix bugs in mac