fix some bug in mac.