crash fix on restore