Fix build errors on Mac