Fix crash on iOS7

Fixes #2519