fix the code to support mac

I have successfully build it on osx 10.9
?