Fixed bug : crash when database reopen