Fixed some bug on the OSX

Signed-off-by: Hugle <wulong@comp.nus.edu.sg>