Fix compilation issues in Mac OSX