Fixed all compile errors for OS X.