Fix bug where dbmfi is referenced after being freed