fix the bug of restoring database