Updated to handle casts to different types

Recently downloaded Xcode 6 beta 4 and forked this repo. Had compile errors trying to run the project, had to make these changes to get it to run.