Fix crashes and reliability