Fix crashes