bugfix: db is nil when init