Fix crash on database restoration