Fixed compile errors on OS X