fix mac os x bugs

Signed-off-by: lional <lional.king@gmail.com>