Add database error management. Add protected keys on wipe