Yosemite build fix

Build fails when using the OS X 10.10 SDK due to the deprecated APIs and type conversion errors. This pull request fixed this.