fix some compile issues on OS X