A few changed to adapt code for Mac OSX compilation.