fix null deref when the db file doesn't exit