Correctly emit events when using db.db by reusing registered db's #1040