Some fixes for OSX compilation.  Closes #450