iOS 6 support & adding explicit long cast