Fix compiler warnings and OSX build failure