Fix for iOS7 crash

(cherry picked from commit 7a4731231d132c70ea49fa6f04e92e7dfe2d25e2)