Fixed several build errors on OS X Mavericks