Fix build warnings on Xcode 6 by adding typecasts.