Fix crashes in Safari