Fix compile errors on OS X